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.
例如,有没有更短的方法
$("td:nth-child(2),th:nth-child(2)").hide()
我试过$("td,th").hide(":nth-child(2)")了,但这不起作用。有人对此有想法吗?谢谢!
$("td,th").hide(":nth-child(2)")
利用.filter()
.filter()
$("td,th").filter(":nth-child(2)").hide();
描述:将匹配元素的集合减少为匹配选择器或通过函数测试的元素。