JavaScript/DOM: Remove an Element

By Xah Lee. Date: . Last updated: .

Here is how to remove an HTML/XML element.

const x = document.getElementById("i10231");

x.parentNode.removeChild(x);

γ€”see Insert Remove Replace Element〕

DOM Common Examples