[JQuery] batch processing of check boxes: All selected, not all selected, and all selected by jquery

Source: Internet
Author: User

[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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.