gpt4 book ai didi

jQuery 结合 td :not(:first-child) and td:empty

转载 作者:行者123 更新时间:2023-12-01 00:07:26 25 4
gpt4 key购买 nike

我试图在我的 jQuery 代码中组合 td:not(:first-child) 和 td:empty 选择器。我在下面附上了代码摘录。此代码利用hoverIntent插件在1秒的时间延迟后执行功能代码。

$(".jqgrow td:not(:first-child)")
.mouseenter(function(){
$.doTimeout('cellhover', 1000, function(e){
my_tooltip
.css({opacity:0.85, display:"none"})
.stop() // Added stop() to fix bug, flickering of tooltip
.fadeIn(10);
});
});

简单来说,如果鼠标不在表格中的第一列上(该表格包含内容与我的工具提示无关的单元格)并且鼠标所在的单元格不为空,我需要触发该函数。我不确定是使用 td:empty 还是使用 use .html()。

我尝试了以下方法,但没有成功:

$(".jqgrow td:not(:first-child) td:empty")
$(".jqgrow td:empty td:not(:first-child)")
$(".jqgrow td:not(:first-child, :empty)")

我看到了与其他问题相关的使用 .is(:empty) 和 filter() 的想法,但我不知道如何将其应用于这种情况。

如果您有任何帮助,我将不胜感激!

最佳答案

td:empty 选择空的单元格,这与您问题中的描述相反,问题中说明您希望它仅应用于为空的单元格>不为空。

根据您的描述,您的最后一个选择器应该可以工作:

// Select td elements in .jqgrow that are neither :first-child nor :empty
$(".jqgrow td:not(:first-child, :empty)")

如果没有,则说明有其他问题。

关于jQuery 结合 td :not(:first-child) and td:empty,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12323102/

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