Javascript Reference
Categories: Range

javascript Range insertNode( )

@March 15, 2008, 1:22 a.m.
insertNode( )Firefox/Netscape/NN 6 IE n/a Chrome/Safari/DOM 2  

insertNode(nodeReference)

  

Inserts a node at the start of the current text range. Most useful when the range is already collapsed as a text insertion pointer. The node being inserted can be created fresh (via document.createElement( )) or fetched from elsewhere in the document tree, in which case it is removed from its old position and inserted into the current range. If you insert a text node adjacent to a spot that also happens to be an existing text node, you can wind up with two adjacent text nodes. Invoke the normalize( ) method on the parent to consolidate the text nodes.

 
Parameters
 
  • Reference to any text, element, or document fragment node to be inserted into the range.
 
Returned Value

Nothing


Powered by Linode.