insertNode method (Range)
Inserts the specified node at the start of the current Range.
This method inserts the specified node into the DOM hierarchy first. The insertion point is the start position (specified by the startContainer and startOffset properties) of the current Range. After that, it sets the start position of the Range to the start position of the newly inserted element.
You can find the related objects in the Supported by objects section below.
|Required. Reference to the node to insert.|
This method has no return value.
Example HTML code 1:
This example illustrates the use of the insertNode method:
Did you find this example helpful?
User Contributed Comments