Showing posts with label nodeName. Show all posts
Showing posts with label nodeName. Show all posts

Thursday, December 17, 2009

Difference between nodeName and tagName

If an SPAN element's nodeName is requested, you will get "SPAN". The same will happen for SPAN element's tagName. But, if a text node is requested for nodeName, it will return "#text" and it's tagName will be "undefined", since it's not really a node.

Check the above using
document.getElementById("yourElementId").nodeName
document.getElementById("yourElementId").tagName