<table>
<tbody>
<tr class="row-1 row-first">
<td><div class="inside">Text</div></td>
<td><div class="inside">Text</div></td>
<td><div class="inside">Text</div></td>
</tr>
<tr class="row-2">
<td><div class="inside"></div></td>
<td><div class="inside">Text</div></td>
<td><div class="inside">Text</div></td>
</tr>
<tr class="row-3 row-last">
<td><div class="inside"></div></td>
<td><div class="inside">Text</div></td>
<td><div class="inside">Text</div></td>
</tr>
</tbody>
</table>
这是我的HTML ..我想知道jQuery中没有空div(带有class =“inside”)的td的数量?我该怎么做呢?
答案 0 :(得分:10)
答案 1 :(得分:4)
答案 2 :(得分:0)
$('td div.inside').filter(function(idx){
return $(this).text() != ""
}).length;