XML DOM nodeNameProperty


Element object

Definition and Usage

The nodeName property returns the tag name of the selected element.

Syntax

elementNode.nodeName


Example

The following code snippet usesloadXMLDoc()put "books.xml" Load into xmlDoc, and get the tag name from the first <title> element:

Example

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName("title")[0];
document.write(x.nodeName);

The above code will output:

title

Try it Yourself »

Element objectother extensions