Latest web development tutorials

XML DOM appendData () method

Text Object Reference Text objects

Definition and Usage

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

grammar

textNode.appendData(string)

参数 描述
string 必需。向文本节点添加的字符串。


Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc to the first <title> element append text:

Examples

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 objects