Last active
August 29, 2015 14:27
-
-
Save jtulk/d1893d6ff0fdd9247730 to your computer and use it in GitHub Desktop.
Example #4: Rewriting jQuery's .each() in Vanilla JS
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
// Loop through the elements in the array-like object | |
// and attach an event listener to each element | |
inputs.forEach(function(el, index, array){ | |
el.addEventListener('focus', textInputFocusHandler); | |
el.addEventListener('blur', textInputBlurHandler); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment