A checkbox is a control that we inevitably use in system development. The usual usage is to select multiple checkboxes, choose All, or cancel all. The use of the checkbox has just been encountered in the previous period. Take a few days to summarize briefly and hopefully give a little help to friends who want to use the CheckBox control.
Sometimes we have to click on a CheckBox control, when it is selected, the other checkbox is all selected, then click on it, that is, uncheck it, all other checkboxes are unchecked. At this point we can use the following code in HTML or. jsp files to implement this functionality. The code is as follows:
<div> <div class= "Checkbox-inline" > <label> <input type= "checkbox" Id= "Checkall" > select all </label> </div></div>
$ (document). Ready (function () { $ ("#checkAll"). Click (function () { if (this.checked) { $ ("input[ Name= ' checkbox ']. each (function () { this.checked=true; }); $ ("[name= ' checkbox ']"). attr ("Checked", ' true '); } Else { $ ("Input[name= ' checkbox ']"). each (function () { this.checked=false; }); $ ("[name= ' checkbox ']"). attr ("Checked", ' false ');}}) ;
check box checkbox is selected, so how do I get the value of the check box checkbook selected?
The above is the checkbox commonly used several functions, hoping to give small partners a little help.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Jquery---Select All or cancel all of the checkboxes