关于JQuery的简单问题:为什么$(this).find("span:first-child")这句话结构不正确?
$("th[role='columnheader']").mouseenter( function(){ var index = $(this).index(); alert( $(this).find("span:first-child").length ); });
我本意是想取得鼠标穿过的列里的第一个span。为什么这里Alert出来的值是3而不是1?
关于JQuery的简单问题:为什么$(this).find("span:first-child")这句话结构不正确?
$("th[role='columnheader']").mouseenter( function(){ var index = $(this).index(); alert( $(this).find("span:first-child").length ); });
我本意是想取得鼠标穿过的列里的第一个span。为什么这里Alert出来的值是3而不是1?
$("th[role='columnheader']") 有多个吧
这样你 看下 $("th[role='columnheader']").length有多少个?