如何选择div下的第二个表结构? [英] How to select second table structure under a div?
问题描述
我试图选择 div
下的每一个表
。
所以我的html就像
< div class ='tableDiv'>
< table class ='table'>
....
< / table>
< table class ='table'>
....
< / table>
< / div>
...其他东西...
< div class ='tableDiv'>
< table class ='table'>
....
< / table>
< table class ='table'>
....
< / table>
< / div>
其他东西
< div class ='anotherTableDiv'>
< table class ='table'>
....
< / table>
< table class ='table'>
....
< / table>
< / div>
我试图选择' 我试过了。 但它不起作用。我无法真正改变课程名称或添加ID,所以它有点困难。任何人都可以给我一个提示吗?非常感谢! 使用jQuery的 I am trying to select every second so my html is like I am trying to select every second table under ' I tried. but it doesn't work. I can't really change class name or add an ID so it's a bit difficult. Can anyone gives me a hint for it? Thanks a lot! Use jQuery's
这篇关于如何选择div下的第二个表结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! tableDiv $ c
$ b
$( '.tableDiv表:第n个孩子(偶数));
:even
p>
$('。tableDiv table:even')
table
under a div
.<div class ='tableDiv'>
<table class='table'>
....
</table>
<table class='table'>
....
</table>
</div>
...other stuff...
<div class ='tableDiv'>
<table class='table'>
....
</table>
<table class='table'>
....
</table>
</div>
other stuff
<div class ='anotherTableDiv'>
<table class='table'>
....
</table>
<table class='table'>
....
</table>
</div>
tableDiv
' div.$('.tableDiv table:nth-child(even));
:even
selector.$('.tableDiv table:even')