I have tons of checkboxes that are either checked (checked="checked"
) or unchecked.
I would like to get the number of all checkboxes, unchecked and checked checkboxes.
With check-box I mean <input type="checkbox" />
.
How to do it with jQuery? Thanks in advance!
There are multiple methods to do that:
Method 1:
Method 2:
Method 3:
The following code worked for me.
You could do:
EDIT
Or even simple
Assume that you have a tr row with multiple checkboxes in it, and you want to count only if the first checkbox is checked.
You can do that by giving a class to the first checkbox
For example
class='mycxk'
and you can count that using the filter, like this