Reputation: 2437
Suppose I have a jQuery object, say it is field of a form and I query it by id:
$("#my_field")
How can I determine the tag of that object, in particular: is it label or input?
Upvotes: 2
Views: 30
Reputation: 55750
You can use the tagName
property on a DOM
object
Accessing jQuery object by index gives you the DOM
object.
$('#my_field')[0].tagName
Upvotes: 3