1. JS Code
Function ($) {
Select All Counter-select
$ ("#selAll"). Click (function () {
$ (". Lists:checkbox"). Not (':d isabled '). Prop ("checked", true);
});
$ ("#unSelAll"). Click (function () {
$ (". Lists:checkbox"). Not (':d isabled '). Prop ("checked", false);
});
$ ("#reverSel"). Click (function () {
Traverse. Lists under the checkbox;
$ (". Lists:checkbox"). Not (':d isabled '). each (function () {
$ (this). Prop ("Checked",!$ (This). Prop ("checked"));
});
});
} (JQuery)
2. HTML code
<input class= "btn btn-default" id= "Selall" type= "button" value= "Select All"/>
<input class= "btn btn-default" id= "Unselall" type= "button" value= "All not selected"/>
<input class= "btn btn-default" id= "Reversel" type= "button" value= "Reverse selection"/>
<div class= "lists" >
<input type= "checkbox" value= "1"/> apple
<input type= "checkbox" value= "2"/> Banana
<input type= "checkbox" value= "3"/> Pineapple
<input type= "checkbox" value= "4"/> Peach
</div>
From: Http://mp.weixin.qq.com/s/XDMtbbvwwIOMRgZxk_cdmQ
jquery Select all, reverse, and select all code