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


CDATA Object Reference CDATA Object


Definition and Usage

The appendData() method adds data to the end of a CDATA node.

Syntax

CDATANode.appedData(string)

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

Example

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

Example

xmlDoc=loadXMLDoc("books_cdata.xml");

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

x.appendData(" Wonderful!");

document.write(x.data);

Output:

Stunning!

Wonderful!

Try it »


CDATA Object Reference CDATA Object