Created
October 2, 2013 11:44
-
-
Save lafikl/6792467 to your computer and use it in GitHub Desktop.
forEach support for document.querySelectorAll
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
// adding forEach to elements result from querySelectorAll | |
NodeList.prototype.forEach = Array.prototype.forEach; | |
HTMLCollection.prototype.forEach = Array.prototype.forEach; | |
document.querySelectorAll('a').forEach( function (element, index, array){ | |
element.style.color = "red"; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment