Created
August 10, 2015 17:48
-
-
Save jtulk/4d4dbd6b429c6afa6c1f to your computer and use it in GitHub Desktop.
Example #5: 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
// Use the Array.prototype.forEach method and the | |
// .call method to loop through the array-like object | |
Array.prototype.forEach.call(inputs, 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