/

HTML / CSS / JavaScript Tutorial

JavaScript DOM HTML method: replaceChild()

[this page | pdf | back links]

The replaceChild() method (when applied to HTML elements in the JavaScript DOM) replaces the specified child node.

 

It has the following syntax with the following parameters. It returns the replaced node (or null if the node does not exist).

 

element.replaceChild(newnode, oldnode)

 

Parameter

Required / Optional

Description

newnode

Required

Node object to be inserted

oldnode

Required

Node object to be removed

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile