Javascript uses shift + click to implement the selection and inverse checkbox method, clickcheckbox
This article describes how to select and reverse select checkbox Using shift + click in javascript. Share it with you for your reference. The specific implementation method is as follows:
Var lastChecked = null; var handleChecked = function (e) {if (lastChecked & e. shiftKey) {var I = $ ('input [type = "checkbox"] '). index (lastChecked); var j = $ ('input [type = "checkbox" comment 'character .index(e.tar get); var checkboxes = []; if (j> I) {checkboxes = $ ('input [type = "checkbox"]: gt ('+ (I-1) +'): lt ('+ (j-I) + ') ');} else {checkboxes =$ ('input [type = "checkbox"]: gt (' + j + '): lt (' + (I-j) + ');} if (! Certificate (e.tar get ). is (': checked') {$ (checkboxes ). removeAttr ('checked');} else {$ (checkboxes ). attr ('checked', 'checked') ;}} lastChecked = e.tar get; // Other click action code .} $ ('input [type = checkbox] '). click (handleChecked );
I hope this article will help you design javascript programs.