Latest web development tutorials

XML DOM data attribute

Text Object Reference Text objects

Definition and Usage

data property sets or returns the text element or attribute.

grammar

textNode.data

Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and outputs the first text <title> element:

Examples

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName("title")[0].childNodes[0];

document.write(x.data);

The code above will output:

Everyday Italian

try it"

Text Object Reference Text objects