user1016403
user1016403

Reputation: 12621

How to find the number checked rows of particular class type?

I have below html table.

<table>
<tr>
<td>
Delete:<br><input type="checkbox" id="deleteCheckOne" class="deleteCheck" name="delete" value="0">
</td>
<td>
Delete:<br><input type="checkbox" id="deleteCheckTwo" class="deleteCheck" name="delete" value="0">
</td>
</tr>
</table>

Now using JQuery i have to find the checked count of the class deleteCheck using JQuery.

How can i fine the count of number of checked checked boxes using JQuery>

Thanks!

Upvotes: 0

Views: 506

Answers (4)

Suresh Atta
Suresh Atta

Reputation: 121998

Use the selector

$('input:checkbox:checked.deleteCheck').length;

Upvotes: -1

iJade
iJade

Reputation: 23801

Checked rows can be selected by :checked and length gives you the count hence,this would help

$('.deleteCheck:checked').length;

Upvotes: 0

Rory McCrossan
Rory McCrossan

Reputation: 337560

You can use the :checked selector to only find the checked inputs, and the length property to find out out many there are.

var checkedCount = $('.deleteCheck:checked').length;

Upvotes: 1

kayen
kayen

Reputation: 4868

$('.deleteCheck:checked').length

Upvotes: 3

Related Questions