我有一个非常有趣的问题(对我来说 :))..
我正在使用 jquery,我想在 HTML 中找到我的引用标记之后的第一个标记。
例如我的 HTML :
<a href="#" class="A" >A</a>
<table>
.....
</table>
<a href="#" class="B" >A</a>
<table>
.....
</table>
<a href="#" class="c" >A</a>
<table>
.....
</table>
我想选择<a href="#" class="A" >A</a>
之后的第一个表, <a href="#" class="B" >B</a>
之后的第一个表... 用 jquery 。因为这个链接是我在 HTML 中的引用标记,所以所有表格都是相同的(没有任何类,ID ...),而且我不知道有多少个表格可以:( ..
谢谢!!!
最佳答案
使用next
:
$('a').click( function() {
var tbl = $(this).next('table'); // find the next table element following the clicked link
});
关于jquery,选择器,查找,文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2259748/