Check box selected by jQuery for statistics _ jquery

Source: Internet
Author: User
Here we will share with you a piece of code on the number of statistics check boxes selected by jQuery. This is very practical. Please take it away if you need it! The code is very brief, and the function is very simple, but it is very practical. Here I will not elaborate on the Code directly.

JQuery code:

The Code is as follows:


Function countNum (){
// Alert ($ ('input [name = check]: checked'). length );
Var arrays = new Array ();
Var items = document. getElementsByName ("check ");
For (var I = 0; I If (items [I]. checked ){
Arrays. push (items [I]. value );
}
}
Alert (arrays. length );
}

HTML code:

The Code is as follows:






If you have the same requirements in the project, refer to xiha. If you have a better way, contact me.

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.