Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有一些<tr>and的 HTML 表格<td>,我需要为某些<td>元素设置一些属性。所以,问题是:
<tr>
<td>
如果我这样写选择器:
$("table tr:not(table tr:first)").css("background","#ccc");
它工作正常,但如果我尝试使用特定的表,什么都不会发生:
$("#tableTit tr:not(#tableTit tr:first)").css("background","#ccc");
我错过了什么?
您无需再次指定 ID。只需这样做:
$('#tableTit tr:not(:first)').css(...);
或者正如@bažmegakapa 在评论中建议的那样:
$('#tableTit tr').not(':first').css(...);