只输入在tr中第一个td中检查的复选框

时间:2012-11-26 13:10:05

标签: javascript jquery

如何获得匹配数/长度:仅输入在tr中第一个td中检查的复选框?

这有效:

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

这不会起作用

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

2 个答案:

答案 0 :(得分:1)

试试这个:

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

答案 1 :(得分:0)

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