XML DOM tagNameProperty


Element object

Definition and Usage

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

Syntax

elementNode.tagName

Example

The following code snippet usesloadXMLDoc()put "books.xmlLoad 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.tagName);

The above code will output:

title

Try it Yourself »

Element objectother extensions