Replace an item in a list with a new item:
Before removing:
After removing:
The replaceChild() method replaces a child node with a new node.
The new node could be an existing node in the document, or you can create a new node.
![]()
The replaceChild() method is supported in all major browsers.
| Parameter | Type | Description |
|---|---|---|
| newnode | Node object | Required. The node object you want to insert |
| oldnode | Node object | Required. The node object you want to remove |
| Type | Description |
|---|---|
| Node object | The replaced node |
| DOM Version | Core Level 1 |
|---|
Node Object
Your message has been sent to W3Schools.