[JQuery] batch processing of check boxes: All selected, not all selected, and all selected by jquery
I have been writing jQuery recently. In fact, I have not systematically studied js. Today I want to share with you the batch processing of check boxes recently written.
<! DOCTYPE html>
Here, check box batch processing is a delete operation. When the "select all" button is selected, all other check boxes are also selected. This "select all" check box is generally used in the list, and all columns in the list are selected after selection. If one of the check boxes in the list is removed, the All check boxes are not selected. When you click "delete selected", You need to delete the row of the selected check box. The following is the JQ code:
<Script> $ (function () {// select all $ (": input [name = 'city _ qx']"). click (function () {if ($ (this ). attr ("checked") = true) {$ (": input [name = 'city']"). attr ("checked", true);} else {$ (": input [name = 'city']"). attr ("checked", false) ;};}) ;}) function isChecked (obj) {// if (obj. attr ("checked") = false) {$ (": input [name = 'city _ qx']"). attr ("checked", false) ;}// delete function del (id, obj) {$. ajax ({// omitted})} // Delete the selected function delChecked () {$ ("input [name = 'city']: checked "). each (function () {del ($ (this ). val (), $ (this) ;}}</script>
For your reference.
Author: Li
Sign: do not have too many fantasies in life, but have more actions.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.