XML DOM dataProperty
Text object
Definition and Usage
The data attribute sets or returns the text of an element or attribute.
Syntax
textNode.data
Example
The following code snippet usesloadXMLDoc()put "books.xmlLoad into xmlDoc and output the text of the first <title> element:
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("title")[0].childNodes[0];
document.write(x.data);
x=xmlDoc.getElementsByTagName("title")[0].childNodes[0];
document.write(x.data);
The code above will output:
Everyday Italian
Try it Yourself »
Text objectother extensions