I am trying to remove an HTML element after changing its visibility to hidden , but I get the following error when I run the following code . It looks like I cannot get the handle to the element because it is hidden.
Missed Error: NOT_FOUND_ERR: DOM 8 elementHidden exception
Is there a way to remove a node that is hidden using pure JavaScript? Due to conflicts, I cannot use any libraries like jQuery.
code from jsFiddle
function elementHidden(e) { if (!e.target.style.opacity) { console.log('Delete this mofo!'); document.removeChild(e.target.parent, e.target); } } document.getElementById("curtain").addEventListener('click', elementHidden, false);
source share