javascript Element insertAdjacentElement( )
insertAdjacentElement( ) | Firefox/Netscape/NN n/a IE 5(Win) Chrome/Safari/DOM n/a | |||||||||
insertAdjacentElement("where", elementObjectReference) | ||||||||||
Inserts an element object into the designated position relative to the current element. Typically, the element object about to be inserted is created separately (for example, via document.createElement( )) or it may be a reference to an object already in the document tree, and the method essentially moves the object to its new location with the help of the insertAdjacentElement( ) method. |
||||||||||
The destination is governed by the first attribute, which consists of one of four values that determine where the insertion occurs, as follows. |
||||||||||
Although the effects on the document element tree are well-defined, the rendered result varies with the combination of inline and block elements you use as the current and inserted element objects. Inserting a block-level element (such as a div or p element) causes that element to render on the next line and at the left edge of the block-level positioning context (such as the body or td element). Applying the W3C DOM appendChild( ) method on elements is the equivalent of the insertAdjacentElement( ) method with the beforeEnd position parameter. |
||||||||||
|
||||||||||
Parameters | ||||||||||
|
||||||||||
Returned Value | ||||||||||
Reference to the inserted element object. |
Powered by Linode.