tags:

views:

78

answers:

3

Hello frineds!

I have a form which have many check boxes in it. User will check one or many checkboxes and click on submit butten. So How could I get the list and count of the input box which are checked.

Please guide me friends.

+1  A: 

Your question is a little ambiguous. If you want a list of all checkboxes & the count of checked ones:

$cb = $(':checkbox');
numChecked = $cb.filter(':checked').length;

However, if you want a list of just the checked checkboxes, and the count of that:

$cb = $(':checkbox:checked');
numChecked = $cb.length;
nickf
I am not sure why this answer was down voted. +1 from my side.
rahul
+1  A: 
// will give all the checked checkboxes in an array
var checkedCheckBoxes = $("input:checkbox:checked"); 
var checkedLength = checkedCheckBoxes.length;
rahul
+1  A: 
numChecked = $(':checkbox:checked').length;
Reigel