Node.appendChild( ): insert a node as the last child of this node — DOM Level 1 Core
newChild) throws DOMException;
The node to be inserted into the document. If the node is a DocumentFragment, it is not directly inserted, but each of its children are.
The node that was added.
This method may throw a DOMException with one of the
code values in the
The node does not allow children, it does not allow children of the specified type, or
newChildis an ancestor of this node (or is this node itself).
newChildis not the same as the
ownerDocumentproperty of this node.
This node is read-only and does not allow children to be appended, or the node being appended is already part of the document tree, and its parent is read-only and does not allow children to be removed.
This method adds the node
to the document, inserting it as the last child of this node. If
newChild is already in the document tree,
it is removed from the tree and then reinserted at its new location.
newChild is a DocumentFragment node,
it is not inserted itself; instead, all its children are appended,
in order, to the end of this node’s
childNodes array. Note that a node from
(or created by) one document cannot be inserted into a different
document. That is, the
ownerDocument property of
newChild must be ...