XML DOM nodeName property
Definition and usage
The nodeName property returns the tag name of the selected node.
Syntax:
elementNode.nodeName
Example
In all examples, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
The following code snippet retrieves the tag name of the first <title> element from "books.xml":
xmlDoc=loadXMLDoc("books.xml");
var x=xmlDoc.getElementsByTagName("title")[0];
document.write(x.nodeName
);
The output of the above code is:
title