# Remove element from DOM

> Remove an existing element from the DOM after checking that it exists.

- Canonical: https://preview.arshadmehmood.com/today-i-learned/javascript/remove-element-from-dom/
- Section: javascript
- Author: Arshad Mehmood

```js
var element = document.getElementById("veryCoolID");
if (element != null) {
    element.parentNode.removeChild(element);
}
```

