Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Add click event to querySelectorAll js

var deleteLinks = document.querySelectorAll('.delete');

Array.from(deleteLinks).forEach(link => {
    link.addEventListener('click', function(event) {
        if (!confirm(`sure u want to delete ${this.title}`)) {
            event.preventDefault();
        }
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js string only positive float numbers 
Javascript :: loop 
Javascript :: UnhandledPromiseRejectionWarning: Error: Node is either not clickable or not an HTMLElement 
Javascript :: get the placeholder value jquery 
Javascript :: set up node js server express 
Javascript :: regex a-z javascript 
Javascript :: react ReferenceError: regeneratorRuntime is not defined 
Javascript :: javascript loop through array backward 
Javascript :: js sync delay 
Javascript :: convert 2 dimensional array to js object 
Javascript :: for elem in list javascript 
Javascript :: how to convert number to array in javascript using Array.from 
Javascript :: expressjs create encrypted password 
Javascript :: javascript get hours difference between two dates 
Javascript :: how to disable a div in javascript 
Javascript :: if string has number javascript 
Javascript :: split sentence including special characters javascript 
Javascript :: navigate to route and refresh angular 6 
Javascript :: react allow only numbers in input 
Javascript :: get array of all property in object array 
Javascript :: datatables cdn file 
Javascript :: concurrently node react 
Javascript :: ffmpeg/avconv not found 
Javascript :: generate random base 64 string js 
Javascript :: javascript print int with leading zeros 
Javascript :: how to send json in js with post 
Javascript :: Iterating through an Object 
Javascript :: mongoose connect database name 
Javascript :: array of objects sahould have unique values 
Javascript :: javascript get domain 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =