I have a bunch of DIVs which do not have IDs or Classes associated with them on my page. I would like to remove any DIV from the DOM simply by I clicking on it so I tried using Node.remove where Node is the clicked DIV. I tried using
document.querySelector(event.target).remove();
but it didn’t work. If I give an ID to each of the DIVs it does work but I would like to know I how to make it work without adding IDs or Classes to the DIVs. Please see my code here .