Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


insertNode Method

Insert a node at the start of a Range.

Syntax

range.insertNode(newNode);
 

Parameters

newNode is a Node.

Example

range = document.createRange();
 
newNode = document.createElement("p"):
 
newNode.appendChild(document.createTextNode("New Node Inserted Here"));
 
range.selectNode(document.getElementsByTagName("div").item(0));
 
range.insertNode(newNode);
 

Notes

newNode is inserted at the start boundary point of the Range. If the newNodes is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text Nodes (Blocked by http://bugzilla.mozilla.org/show_bug.cgi?id=135922 )

If newNode is a document fragment, the children of the document fragment are inserted instead.

Specification

insertNode

Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.