TOC PREV NEXT INDEX

Put your logo here!


insertBefore


The insertBefore method allows you to insert a node before the current element in the DOM.

Syntax

element.insertBefore(targetElement) 

Parameters

targetElement is the node before which the current element will appear in the tree.

Example

sp2 = document.getElementById("first-span"); 
sp1 = document.createElement("span"); 
sp1.insertBefore(sp2); 
// sp1 is now before <span id="first-span" /> 
// in document tree. 

Notes

None.

Specification

core


mozilla.org | mailto:oeschger | bug 93108
TOC PREV NEXT INDEX