Latest web development tutorials

XML DOM length property

Text Object Reference Text objects

Definition and Usage

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

grammar

textNode.length

Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and outputting a text node <title> element of data and length:

Examples

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 objects