Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

an image gallery is a set of images with corresponding remove buttons

function setup() {
    var els = document.getElementsByClassName("remove");
    for (var i = 0; i < els.length; i++) {
        els[i].addEventListener('click', function (e) {
            e.preventDefault();
            e.target.closest('div.image').remove();
        });
    }
}
setup();
 
PREVIOUS NEXT
Tagged: #image #gallery #set #images #remove #buttons
ADD COMMENT
Topic
Name
2+5 =