How to replace a child node with a new node in JavaScript?

Posted by Prem Tiwari | Updated on

Want to replace a child node with a new node in JavaScript? XML DOM replaceChild() Method 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. Tip: The replaced child node can be inserted later into any element in the same document.

Output


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers