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

XML DOM appendData() Method

XML DOM appendData() Method


Text Object Reference Text Object


Definition and Usage

The appendData() method adds a string to the end of a text node.

Syntax

textNode.appendData(string)

Parameters Description
string Required. The string to add to the text node.

Example

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

Example

xmlDoc=loadXMLDoc("books.xml");

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

x.appendData(" Cooking");

document.write(x.data);

Output:

Everyday Italian Cooking

Try it »


Text Object Reference Text Object