开发者

is an element an input?

How can you check if an element is an input?

if(elm.val() == null){
// is not an input
}
els开发者_运维知识库e{
// is an input
}


Well you know what element you are selecting.

or (if you really do not know) you can do:

if(elm.is('input')) {} //assuming elm is a jQuery element
else {}


You can use the is function to determine if an element is an input tag:

jQuery(elm).is("input");


//jquery    
if( $("#elementid").is("input") ){}
    else
    {}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜