Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 25. Client-Side JavaScript Refer... > Node.replaceChild( ): replace a chil...

Node.replaceChild( ): replace a child node with a new nodeDOM Level 1 Core

Synopsis

Node replaceChild(NodenewChild,
                  Node oldChild)
    throws DOMException;

Arguments


newChild

The replacement node.


oldChild

The node to be replaced.

Returns

The node that was removed from the document and replaced.

Throws

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial