Created
May 22, 2017 12:55
-
-
Save andreasvirkus/7dba8d7603e09860bb61792da39acc3e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* A quick (and rather sexy) way to loop over a NodesList and add event listeners to all elements | |
*/ | |
[].forEach.call(nodeList, function(e) { | |
e.addEventListener('click', callback, false); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment