我需要检查父项是tbody还是thead标记.
我现在有这个,这不起作用:
item.parent("thead")[0] = "<thead>" ? console.log("yes") : console.log("no");
虽然不起作用.
什么提示我做错了什么?
谢谢!
解决方法
认为这将有效:
console.log(item.parent("thead").is("thead") ? "Yes" : "No");
http://jsfiddle.net/G9LJT/0/ – 没有
http://jsfiddle.net/G9LJT/1/ – 是的
…
item.parent(“thead”)[0]指的是选择器的第一个DOM元素.