Latest web development tutorials

XML DOM tagName property

Element Object Reference Element object

Definition and Usage

tagName property returns the tag name of the selected element.

grammar

elementNode.tagName

Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc and made the tag name from the first <title> element:

Examples

xmlDoc=loadXMLDoc("books.xml");

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

The code above will output:

title

try it"

Element Object Reference Element object