Created
February 27, 2017 22:35
-
-
Save NicholasEli/89799c128500f93827c613476c610237 to your computer and use it in GitHub Desktop.
IE compatible for-loops and event attachments
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
//passing i to an anonymous self executing funtion will bind event handlers to DOM nodes from IE9 and up. Haven't checked for IE9 and below. | |
for (let i = 0; i < el.length; i++) { | |
(function(i){ | |
el[i].addEventListener('click', (event) => { | |
}); | |
})(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment