stop bubbling
<body onclick="alert(`the bubbling doesn't reach here`)"> <button onclick="event.stopPropagation()">Click me</button> </body>
Source: javascript.info
remove anything through bubbling
const list = document.querySelector('#book-list ul'); list.addEventListener('click', function(e) { console.log("hello"); if (e.target.className == "delete") { const li = e.target.parentElement; list.removeChild(li); } })