Assuming I have an element called menu
how would I remove this element from the page? Is there a document.removeElementById
function? or something equivalent?
Assuming I have an element called menu
how would I remove this element from the page? Is there a document.removeElementById
function? or something equivalent?
2 Answers
Reset to default 9No direct mand but this will do what you need:
var element = document.getElementById("menu");
element.parentNode.removeChild(element);
You can wrap it nicely with function if you want. :)
This should work?
document.removeChild(menu);
Or
menu.parentNode.removeChild(menu);