Created
December 22, 2016 09:23
-
-
Save iworkforthem/c4421147735524b5677f3207d7316452 to your computer and use it in GitHub Desktop.
addEventListener to body specified tag.
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
document.querySelector("body").addEventListener('click', function(e) { | |
var a = e.target.closest('a'); | |
if (a !== null) { | |
console.log(a); | |
} | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment