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)); }