Latest web development tutorials

XML DOM textContent property

Attr Object Reference Attr objects

Definition and Usage

textContent property sets or returns the text attributes.

grammar

attrObject.textContent


Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and returns the text content category attribute:

Examples

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName('book');

for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].textContent);
document.write("
");
}

Output:

COOKING
CHILDREN
WEB
WEB

try it"

Try Demos

textContent - set the properties of the text


Attr Object Reference Attr objects