Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Node replaceChild(NodenewChild,
Node oldChild)
throws DOMException;newChild
The replacement node.
oldChild
The node to be replaced.
The node that was removed from the document and replaced.
This method may throw a DOMException with the following code values:
HIERARCHY_REQUEST_ERR
This node does not allow children, it does not allow children of the specified type, or newChild is an ancestor of this node (or is this node itself).
WRONG_DOCUMENT_ERR
newChild and this node have different values for ownerDocument.
NO_MODIFICATION_ALLOWED_ERR
This node is read-only and does not allow replacement, or newChild is the child of a node that does not allow removals.
NOT_FOUND_ERR
oldChild is not a child of this node.