Monday, April 11, 2011

finding the type of an element using jquery

in jquery, if i have the reference of an element, how can i know what kind of element is it, like an input or an dropdown ? is there any way to find out?

Duplicate:

http://stackoverflow.com/questions/341900/how-can-i-determine-the-element-type-of-a-matched-element-in-jquery

From stackoverflow
  • 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
    

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.