Search
 
SCRIPT & CODE EXAMPLE
 

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();
Comment

PREVIOUS NEXT
Code Example
Javascript :: jsx emmet vscode 
Javascript :: scroll to class jquery 
Javascript :: discord.js join voice channel 
Javascript :: js get first 3 characters of string 
Javascript :: ejs / javascript check if array/object exists and is not empty 
Javascript :: linebreak-style 
Javascript :: javascript compare two arrays of objects get same elements 
Javascript :: pattern cpf js 
Javascript :: js check if infinity 
Javascript :: how to append more elements after click in react 
Javascript :: jquery number format comma 
Javascript :: set nested state react hooks spread operator 
Javascript :: save things javascript 
Javascript :: adonisjs findorcreate 
Javascript :: jquery on hover event 
Javascript :: date of birth validation in yup 
Javascript :: react npm build 
Javascript :: javascript before reload page alert 
Javascript :: yarn react-bootstrap 
Javascript :: load js after ajax 
Javascript :: get how much i scroll in js 
Javascript :: js get all object styles 
Javascript :: convert hsl to hex code javascript 
Javascript :: javascript absolute value 
Javascript :: how to change the font family using jquery 
Javascript :: extract filename from content-disposition header js 
Javascript :: if button is keeping pressed execute increment javascript 
Javascript :: update node ubuntu 
Javascript :: npm react redux logger 
Javascript :: how to prevent the form from getting automatically submitted javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =