This article introduces the sample code based on jquery code, which is easy to understand and practical, if you are interested in learning it together, this article will share with you a piece of code based on jQuery's full selection, reverse selection, and unselection functions. This is suitable for scenarios where multiple web pages require batch operations (such as batch deletion ). This article uses examples to simplify the code and covers all aspects of the Option Selection operation, hoping to help WEB enthusiasts who need it.
// Select all
$ ('# Checkall '). click (function () {// determine if var bischecked is selected = $ ('# checkall '). is (': checked'); var fruit = $ ('input [name = "check"]'); bischecked? Fruit. attr ('checked', true): fruit. attr ('checked', false );});
// Re-select the checkbox. If it is selected, it is set to deselected. Otherwise, it is the same.
$("#tabVouchList tr").each(function () { if ($("td:eq(0) input[name='check']", $(this)).is(':checked')) { $(this).attr('checked', false); } else { $(this).attr('checked', true); } });
HTML table
| |
Row number |
Name |
| |
Row number |
Name |
The above code is all the code for jquery to achieve full selection without selecting the inverse. Is the code very simple? I hope it will be helpful for everyone's work and learning.