Last active
December 17, 2020 08:16
-
-
Save jstask82/1a7dc49d84b5ef97307e473a86ea491e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handleClick(e){ | |
console.log('this target has been clicked:', e.currentTarget); | |
} | |
elementsList.forEach(e => e.addEventListener('click', handleClick, false)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handleClick = (e) => { | |
if ( | |
e.target.closest(".class") || | |
) | |
//Do stufff | |
}; | |
somelEment.addEventListener("click", handleClick); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment