JQuery saves the value of the selected checkbox check box to the array, jquerycheckbox

Source: Internet
Author: User

JQuery saves the value of the selected checkbox check box to the array, jquerycheckbox

JQuery saves the value of the selected checkbox check box to an array:
In practice, you may need to select the value of the check box to store it in an array for subsequent operations. The following is a piece of code that can implement this function.
The Code is as follows:

 

<! DOCTYPE html> 

 

The above code implements our requirements. The implementation principle is also very simple, that is, to obtain the checkbox check box jQuery object set, and then traverse each check box element in the set through the each () function, then, determine whether the element is selected. If it is selected, it is saved to the array.
Related reading:
1. For details about the each () function, refer to the each () method section of jQuery.
2. $ ("input [name = items]") refer to [attribute = value] selector in jQuery.
3. For more information about the push () function, see the push () method section of the Array object in javascript.
4. For the join () function, see the join () method section of the Array object in javascript.

The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 12614.

For more information, see: http://www.softwhy.com/jquery/

 

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.