我有一个 HTML 表格,其中包含一些 <tr>
和<td>
,我需要为某些 <td>
设置一些属性元素。所以,问题是:
如果我写选择器 this way :
$("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(...);
关于jquery - 使用伪元素 jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10556200/