Skip to content

Instantly share code, notes, and snippets.

@jstask82
Last active December 17, 2020 08:16
Show Gist options
  • Save jstask82/1a7dc49d84b5ef97307e473a86ea491e to your computer and use it in GitHub Desktop.
Save jstask82/1a7dc49d84b5ef97307e473a86ea491e to your computer and use it in GitHub Desktop.
const handleClick(e){
console.log('this target has been clicked:', e.currentTarget);
}
elementsList.forEach(e => e.addEventListener('click', handleClick, false));
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