appendChild method

Node appendChild(
  1. Node node
)

The appendChild() method of the Node interface adds a node to the end of the list of children of a specified parent node.

Note: If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position.

If the given child is a DocumentFragment, the entire contents of the DocumentFragment are moved into the child list of the specified parent node.

appendChild() returns the newly appended node, or if the child is a DocumentFragment, the emptied fragment.

Note: Unlike this method, the Element.append method supports multiple arguments and appending strings. You can prefer using it if your node is an element.

Implementation

external Node appendChild(Node node);