Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Event Delegation Example In JavaScript

	selector = ".buttonClass";
document.getElementById('buttons').addEventListener('click', event => { // Step 2
      if (event.target.matches(selector)) {
        console.log('Click!');
      }
    })
 
PREVIOUS NEXT
Tagged: #Event #Delegation #Example #In #JavaScript
ADD COMMENT
Topic
Name
3+9 =