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
{}
精彩评论