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