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

XML DOM length Property

XML DOM length Property


Text Object Reference Text Object


Definition and Usage

The length property returns the text length of a node (in characters).

Syntax

textNode.length


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 node data and length:</p>

Example

xmlDoc=loadXMLDoc("books.xml");

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

document.write(x.data);

document.write(" - Length: ");

document.write(x.length);

The code above will output:

Everyday Italian - Length: 16

Try it »


Text Object Reference Text Object