Hello-World
Hello-World

Reputation: 9555

only input check boxes that are checked in the first td in a tr

How do I get the the number of matches/length of: only input check boxes that are checked in the first td in a tr?

this works:

$('#myTable').find('tr td input[type=checkbox]:checked').parents('tr').length;

this wont work

$('#myTable').find('tr td:eq(0) input[type=checkbox]:checked').parents('tr').length;

Upvotes: 1

Views: 163

Answers (2)

Hello-World
Hello-World

Reputation: 9555

$('#myTable tr').find('td:eq(0) input[type=checkbox]:checked').length;

Upvotes: 0

mgraph
mgraph

Reputation: 15338

try this:

$('#myTable').find('tr td:first input[type=checkbox]:checked').length;

Upvotes: 1

Related Questions