appendChild (DOMNode - JavaScript)

Appends a child node.

Defined in

DOMNode

Syntax

appendChild(node:DOMNode) : DOMNode

Parameters Description
node A DOM object. Effectively this can be any class that inherits from DOMNode.
Return value Description
DOMNode The attached node.

Usage

The node is added to the DOM below the current node after any other child nodes.

Examples

This button creates a document with a hierarchy of elements.
var doc = database.createNewDocument();
var dom = doc.getDOM();
var schema0 = dom.createElement("schema0");
var element0 = dom.createElement("element0");
var attr = dom.createAttribute("Owner");
attr.setValue(session.getCommonUserName());
dom.appendChild(schema0);
schema0.appendChild(element0);
element0.setStringValue(requestScope.s);
element0.setAttributeNode(attr);
doc.save()
The XML for this document might appear as follows:
<schema0>
  <element0 Owner="wpsadmin">foo</element0>
</schema0>