Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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);
        }
    })
Source by javascript.info #
 
PREVIOUS NEXT
Tagged: #remove #bubbling
ADD COMMENT
Topic
Name
1+5 =