Javascript 如何选择div下的第二个表结构?
我正在尝试在Javascript 如何选择div下的第二个表结构?,javascript,jquery,html,jquery-selectors,Javascript,Jquery,Html,Jquery Selectors,我正在尝试在div下选择每秒表 所以我的html就像 <div class ='tableDiv'> <table class='table'> .... </table> <table class='table'> .... </table> </div> ...other stuff... <div class ='tableDiv'> <table clas
div
下选择每秒表
所以我的html就像
<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>
但它不起作用。我不能真正更改类名或添加ID,所以这有点困难。有人能给我一个提示吗?非常感谢 使用jQuery的
:偶数选择器
$('.tableDiv table:even')
使用jQuery的:偶数
选择器
$('.tableDiv table:even')
请确保关闭您的报价标记。除了这一点,你开始做的一切都很好。请确保关闭引号。除此之外,您开始使用的一切都很好。查看jQuery.each()查看jQuery.each()