gpt4 book ai didi

jQuery:包括除包含 TH 之外的所有 TR

转载 作者:行者123 更新时间:2023-12-01 03:19:57 26 4
gpt4 key购买 nike

我想要获取不包含 TH 的所有 TR 的列表。

我的初始选择器是

$(".lanes tr")

我尝试使用 not 选择器来限定它,但它不太有效

var rowsToInclude = $(".lanes tr").not(function(){
return ($(this).find('th').length == 0) ? false : true;
});

我的语法是否错误,或者是否有更简单的方法来实现此目的?

最佳答案

这不是 :not() 选择器,而是 .not() 方法。通过实际使用选择器,事情变得简单得多:

$(".lanes tr:not(:has(th))")

关于jQuery:包括除包含 TH 之外的所有 TR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11016479/

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