Jquery – finding the type of an element using jQuery

jquery

In jQuery, if I have a reference to an element, how can I determine what kind of element it is, for example, an input or an dropdown? Is there any way to find out?

Duplicate:

How can I determine the element type of a matched element in jQuery?

Best Answer

The following will return true if the element is an input:

$("#elementId").is("input") 

or you can use the following to get the name of the tag:

$("#elementId").get(0).tagName