Use jquery to determine the selection of a checkbox.
There is a problem when using the $ (). attr (' checked ') to select and deselect the 12th time, but the third time, there is no response at All.
After that, $ () is Used. prop () yes, it is.
//Select All and select All$ ("#allorone_check"). Click (function(){ if(!$( this). Hasclass ("selectall") {console.log ($ ("#lxyzlist input[type=checkbox]")); $(". tbodylist input:checkbox"). Prop ("checked",true); $( this). AddClass ("selectall"); }Else{ $("#lxyzlist input:checkbox"). prop ("checked",false); $( this). Removeclass ("selectall"); } }); //Inverse Selection$ ("#invert_check"). Click (function(){ $(". tbodylist input[type=checkbox]:checkbox"). each (function () { //$ (this). attr ("checked",!$ (this). prop ("checked")); $( this). prop ("checked",function(index, Attr) {return!attr; }); }); });
jquery Determines if checkbox is selected and changed checkbox status