Home  »  CheatsheetsCodeProgrammingSnippetsSoftwareTechnology   »   JavaScript Remove Element From the Dom

JavaScript Remove Element From the Dom

Posted: March 10, 2022 | by Site Host

JavaScript, remove element:

var element = document.getElementById("myElementID");
element.parentNode.removeChild(element);

Alternate:

var element = document.querySelector('#some-element');
element.parentNode.removeChild(elem);

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Share it!

See also  How to Read a File in Python