The jquery method is as follows:
Copy Code code as follows:
Function Checkall (val) {
$ ("Input[name= ' Chkjob ']"). each (function () {
this.checked = val;
});
$ ("#chkAll"). attr ("Checked", Val);//Set all Select button Status
}
Val, this parameter passes the selection state of the full selection button.
Name= ' Chkjob ' This is the name of the checkbox in the list
Chkall is the full Select button name
Love the simplicity and clarity of jquery ...
It's a little bit different from what you write with JavaScript!
eg
JavaScript Select All-in-selection code
Copy Code code as follows:
//Select all
function Checkall () {
var all = document.getElementsByTagName ("input");
for (var i = 0; i < all.length i++) {
if (All[i].type = = "checkbox") {
all[i].checked = true;
}
}
}
//Checknull
Function-() {
var all = document.getElementsByTagName ("input");
for (var i = 0; i < all.length i++) {
if (All[i].type = = "checkbox") {
all[i].checked = false;
}
}
}