document.getElementById('the_element_id').outerHTML = '';
This is arguable the simplest and most cross-browser friendly way to remove an element from the DOM. Essentially, we're just setting the elements outer HTML to an empty string, which removes the element.
Snippet Viewed 409 times.
- Get some recognition & a link back to your site.
- Create your own code library.
- Help your fellow developers, as they have helped you.