Libraryless. Click here for Pure Java version (3080L/20K).
sS hCheckBoxMultiSelect_v2(O... _) { optPar bool verbose; ret hscript(replaceDollarVars([[ var lastChecked; $(document).ready(function() { console.log("document ready"); $("input[type=checkbox]").click(function(e) { var verbose = $verbose; var cls = this.className; if (verbose) console.log("cls=" + cls); if (!cls) return; if (!lastChecked || lastChecked.className != cls) { lastChecked = this; return; } var $chkboxes = $('input[type=checkbox].' + cls); if (e.shiftKey) { var start = $chkboxes.index(this); var end = $chkboxes.index(lastChecked); // change checkboxes, trigger their change event in case there are handlers installed $chkboxes.slice(Math.min(start, end), Math.max(start,end)+1).prop('checked', lastChecked.checked) .each(function(idx, chkbox) { chkbox.dispatchEvent(new Event('change')); }); } lastChecked = this; }); }); ]], +verbose)); }
Began life as a copy of #1008423
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030223 |
Snippet name: | hCheckBoxMultiSelect_v2 - works with all checkboxes that have a class |
Eternal ID of this version: | #1030223/8 |
Text MD5: | 7dacb06b02a20121d307e09c6e3d985c |
Transpilation MD5: | 9bbc0860f8fae9a3a22921f9384032b6 |
Author: | stefan |
Category: | javax / html |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-17 14:29:40 |
Source code size: | 1136 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 226 / 312 |
Version history: | 7 change(s) |
Referenced in: | [show references] |