Recently, I have been studying JQUERY's CHECKBOX. I have already introduced the full selection and cancellation of the CHECKBOX. Now I will continue to share with you the third method. At the same time, I can implement the inverse selection and specified selection of the CHECKBOX, of course, we must first download jquery.checkboxes.zip and decompress and reference it to the page using the plug-in,
You don't need to talk about this! Let's take a look at the specific example below. In order to give everyone a better understanding, I directly paste the code that implements the function:
The Code is as follows:
$ ("# Myform"). toggleCheckboxes () // select all. deselect all and select inverse.
$ ("# Myform"). toggleCheckboxes (": not (# checkbox1)") // select all. uncheck all and the first one.
$ ("# Myform"). toggleCheckboxes (". top5", true) // select all. deselect all and select only the first five.
$ ("# Myform"). checkCheckboxes (); // select all
$ ("# Myform"). checkCheckboxes (": not (# checkbox1)"); // select all except the first one.
$ ("# Myform"). checkCheckboxes (". top5", true); // select all the first five
$ ("# Myform"). unCheckCheckboxes (); // cancel all selections
$ ("# Myform"). unCheckCheckboxes (": not (# checkbox1)"); // deselect all to exclude the first
$ ("# Myform"). unCheckCheckboxes (". top5", true); // cancel all selection to exclude the first five
Here, checkbox1 indicates the ID value and top5 indicates the CLASS value! I will introduce it here. If you are interested, you can download and use it yourself. You can also take a look at the official demo!
: Http://plugins.jquery.com/files/jquery.checkboxes.zip
Demo address: http://www.texotela.co.uk/code/jquery/checkboxes/
Please share your suggestions or good methods. Thank you!