检查element是否为div [英] Check if element is a div
本文介绍了检查element是否为div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查$(this)
是div
,ul
还是blockquote
?
例如:
if ($(this) is a div) {
alert('its a div!');
} else {
alert('its not a div! some other stuff');
}
推荐答案
类似以下内容:
if(this.tagName == 'DIV'){
alert("It's a div!");
} else {
alert("It's not a div! [some other stuff]");
}
这篇关于检查element是否为div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文