gpt4 book ai didi

jquery - 为什么我不能循环遍历 Jquery 中动态加载的每个表行?

转载 作者:行者123 更新时间:2023-12-01 08:21:26 24 4
gpt4 key购买 nike

我正在使用的表是在运行时通过ajax加载的,我尝试使用下面的代码循环遍历表中的所有行:

alert("here"+jQuery('#contentItems table.tablesorter table tbody tr')); //I get here[Object object]
jQuery('#contentItems table.tablesorter table tbody tr').each(function(){
alert("test");
});

我收到第一个警报,但没有针对测试发出警报。

哦,这段代码是从文档的 mouseup 事件运行的。

有什么建议吗?

最佳答案

看来您的选择器中可能有一个额外的表格标记。

这个:

'#contentItems table.tablesorter table tbody tr'

可能需要:

'#contentItems table.tablesorter tbody tr'

关于jquery - 为什么我不能循环遍历 Jquery 中动态加载的每个表行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7166276/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com