如何向每个tr中的第一个和第二个td添加类
<;div class='location'>;
<;表>;
<;t车身>;
<;tr>;
<;td>;这个</td>;
<;td>;这个</td>;
<;td>;其他</td>;
<;td>;这里</td>;
</tr>;
<;tr>;
<;td>;这个</td>;
<;td>;这个</td>;
<;td>;其他</td>;
<;td>;这里</td>;
</tr>;
</t车身>;
</表>;
</部门>;
对于第一个td,这没有任何作用
$(“.location table tbody tr td:first child”).addClass(“黑色”);
我也可以使用second child吗
$(“.location table tbody tr td:first child”).addClass(“黑色”);
$(“.location table tbody tr td:nth child(2)”).addClass(“黑色”);
http://jsfiddle.net/68wbx/1/