Easy Tutorial
❮ Dom Nodelist Dom Met Document Getelementsbytagname ❯

XML DOM appendChild() Method



Definition and Usage

The appendChild() method appends a new child node to the end of the list of children of a node.

This method returns the new child node.

Syntax

Parameter Description
newchild The node to append.

Example

The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc, creates a node (<edition>), and appends it after the last child node of the first <book> node:

Example

Output:


Try It

appendChild() - Append a child node to all <book> nodes


❮ Dom Nodelist Dom Met Document Getelementsbytagname ❯