fre*_*ent 3 javascript jquery parent
我需要检查父项是tbody还是thead标记.
我现在有这个,这不起作用:
item.parent("thead")[0] = "<thead>" ? console.log("yes") : console.log("no");
Run Code Online (Sandbox Code Playgroud)
虽然不起作用.
什么提示我做错了什么?
谢谢!
认为这将有效:
console.log(item.parent("thead").is("thead") ? "Yes" : "No");
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/G9LJT/0/ - 没有
http://jsfiddle.net/G9LJT/1/ - 是的
...
item.parent("thead")[0] 指的是选择器的第一个DOM元素.