隐藏特定表的第n个子项 [英] Hiding nth-child of a specific table
本文介绍了隐藏特定表的第n个子项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在页面上有两个表格.如何处理第二个id="tapp"
以运行show/hide nth-child功能?
I have two tables on a page. How do I address the second one, id="tapp"
, to run show/hide nth-child functions?
我无知地试图通过将id引用添加到'td:nth-child...'
I've ignorantly tried to address the particular table by adding the id reference to the beginning of 'td:nth-child...'
...
var x = document.getElementById("tatt");
$(x.'td:nth-child(3),th:nth-child(3)').hide();
...
推荐答案
在每个逗号分隔的组中,可以在选择器之前加上 id .试试
You can precede the selector by id in each comma separated group. Try
$('#tatt td:nth-child(3), #tatt th:nth-child(3)').hide();
注意:为什么已经使用jQuery的人为什么要使用getElementById()
?
Note: Why you are using getElementById()
when you already have jQuery?
这篇关于隐藏特定表的第n个子项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文