我有几个具有相同类的表,每个表有 2 行。我想给第二行每个表中的 td 元素一个特定的类,但我这样做的方式只对第一个表有用,我不知道为什么。
$('#main table.asseenin_table tr:eq(1) td').addClass('asi_second');
只有 FIRST 表第二行中的 td 元素获得类,其他表没有。
<table class="asseenin_table">
<tr>
<td><a href="#"><img src="images/asseenin/1.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/2.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/3.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/4.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/5.jpg" /></a></td>
</tr>
<tr>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
</tr>
</table>
<table class="asseenin_table">
<tr>
<td><a href="#"><img src="images/asseenin/6.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/7.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/8.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/9.jpg" /></a></td>
<td><a href="#"><img src="images/asseenin/10.jpg" /></a></td>
</tr>
<tr>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
<td>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
<a href="#"><img src="images/asseenin/thumbs/thumb.jpg" /></a>
</td>
</tr>
</table>