Ada*_*yle 4 jquery jquery-selectors
我正在尝试在我的jQuery代码中组合td:not(:first-child)和td:empty selectors.我在下面附上了一段代码摘录.此代码使用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);
});
});
Run Code Online (Sandbox Code Playgroud)
简单来说,如果鼠标不在我表中的第一列(这个表包含其内容与我的工具提示无关的单元格)并且鼠标所在的单元格不为空,我需要触发该函数.我不确定是否使用td:empty或使用.html().
我尝试了以下没有奏效的方法:
$(".jqgrow td:not(:first-child) td:empty")
$(".jqgrow td:empty td:not(:first-child)")
$(".jqgrow td:not(:first-child, :empty)")
Run Code Online (Sandbox Code Playgroud)
我看到使用.is(:empty)和filter()与其他问题相关的想法,但我不知道如何将其应用于这种情况.
我会感激任何帮助!
td:empty选择该细胞是空的,这违背了你的问题,你希望它仅适用于那些细胞,其中列明了说明不是空的.
根据您的描述,看起来您的上一个选择器应该工作:
// Select td elements in .jqgrow that are neither :first-child nor :empty
$(".jqgrow td:not(:first-child, :empty)")
Run Code Online (Sandbox Code Playgroud)
如果没有,那就别错了.
| 归档时间: |
|
| 查看次数: |
4414 次 |
| 最近记录: |