What is the best way to get an element's tag name in JS?
Posted
by webdestroya
on Stack Overflow
See other posts from Stack Overflow
or by webdestroya
Published on 2010-05-01T21:11:59Z
Indexed on
2010/05/01
21:17 UTC
Read the original article
Hit count: 247
I want to get the name of a certain tag (to tell whether it is a div/input/span/p/so on)
I found that there are 3 different attributes that give me the tag name:
tagName
, nodeName
, and localName
My question is: Which one is the most supported in all browsers? And/or is there a method to get the tag name in Prototype (I looked but couldn't find one)?
© Stack Overflow or respective owner