TOC PREV NEXT INDEX

Put your logo here!


replaceChild


The replaceChild() method replaces one child node on the current element with another.

Syntax

element.replaceChild(oldChild, newChild) 

Parameters

newChild is a node.

oldChild is the existing child node to be replaced.

Example

// <div id="top" align="left"> 
//    <div id="in">in</div> 
// </div> 
d1 = document.getElementById("top"); 
d_new = document.createElement("p"); 
d1.replaceChild(d1, d_new); 
alert(d1.childNodes[0].tagName) 

Notes

extra information

Specification

core


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