Replace an element

The ele will be removed from the DOM tree, and is replaced with newEle:

ele.parentNode.replaceChild(newEle, ele);
Previous
Remove an element
Next
Replace broken images