org.w3c.dom.Node.insertBefore
method

    public insertBefore(newChild as Node, refChild as Node) as Node throws DOMException

Description

Inserts a node before a reference child.

Parameters

Parameter | Description
--- | ---
`newChild` | Node to insert.
`refChild` | Reference child, or null to append.

Returns

Inserted node.

Throws

- DOMException if insertion is invalid.

Example

    parent.insertBefore(child, parent.firstChild)