比如有没有更短的方法
$("td:nth-child(2),th:nth-child(2)").hide()
我尝试了 $("td,th").hide(":nth-child(2)")
但这不起作用。有人对此有想法吗?谢谢!
最佳答案
$("td,th").filter(":nth-child(2)").hide();
.过滤器(选择器)
Description: Reduce the set of matched elements to those that match the selector or pass the function's test.
关于javascript - 带有共享修饰符的 jQuery "OR"选择器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18616768/