ReplaceChild(<NewNode>, <OldNode>)


<NewNode> (required)

Type: HTMLAnchorElement.
A new child node.

<OldNode> (required)

Type: HTMLAnchorElement.
The existing child node.

Returned value:

The previous node value.


Replaces a child node specified in the <OldNode> parameter by a node specified in the <NewNode> parameter.
If the new node is DocumentFragment, the replaced node will be replaced by all child nodes of the document fragment.
If the new node is already included in the document tree, it is first deleted from the child nodes of the previous parent and then is inserted into the child node list of the new parent.


Thin client, server, thick client, external connection, Mobile application (client), Mobile application (server).


An exception is triggered:
  • if the given node does not allow the node being added as a child node or if the added node is a parent for the given.
  • if the node is added to itself.
  • if the given node - Document and the second node DocumentType or Element is added.
  • if the node being added was created by the document different from the one that created the given node.
  • if the given node is in the read-only mode or if the previous parent of the added node in the Read-only mode.
  • if the replaced node is not found.
  • if the added node is a child node for the Document node and implementation does not support deleting DocumentType and Element nodes from the Document node.


1C:Enterprise Developer's Community