Which method would you use to replace an HTML element with another?

  • replaceElement()
  • replaceChild()
  • swapElement()
  • switchElement()
The correct method to replace an HTML element with another in JavaScript is replaceChild(). This method allows you to replace a child element within a parent element. It takes two arguments: the new element to be inserted and the old element to be replaced.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *