Event agent removes the error problem of child elements

clipboard.png

for help.


Brother dei, removeChild is a child element that removes an element. If you remove the parent element from the child element, of course you report an error. And the reason for reporting the error has been written in detail


read the comments upstairs. If the level is ul > li > div > em , then subNode = e.target.parentNode.parentNode :
e.target is em
e.target.parentNode is div
e.target.parentNode.parentNode is li

Menu