Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM data Property

XML DOM data Property


Text Object Reference Text Object


Definition and Usage

The data property sets or returns the text of an element or an attribute.

Syntax

textNode.data


Example

The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and output the comment text of the first The element's text:</p>

Example

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 Object