The insertBefore() method of the Node interface inserts a node before a reference node as a child of a specified parent node.
If the given node already exists in the document, insertBefore() moves it from its current position to the new position. (That is, it will automatically be removed from its existing parent before appending it to the specified new parent.)
This means that a node cannot be in two locations of the document simultaneously.
public Node InsertBefore(Node node, Node child)
|node||Node||The node to be inserted.|
|child||Node||The node before which newNode is inserted. If this is null, then newNode is inserted at the end of node’s child nodes.|