<div id="div-01">Here is div-01</div>
<div id="div-02">Here is div-02</div>
<div id="div-03">Here is div-03</div>Element: remove() method / notebook
Element: remove() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const element = document.getElementById("div-02");
element.remove(); // Removes the div with the 'div-02' idwith (node) {
remove();
}
// ReferenceError: remove is not defined