Created
October 6, 2018 05:57
-
-
Save tzi/9c6c221758212ced73e0c92a4173acb3 to your computer and use it in GitHub Desktop.
querySelectorAll but iterable
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
function $$ (query) { | |
return Array.from(document.querySelectorAll(query)); | |
} |
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
$$('a').forEach(function(link) { | |
console.log(link.innerHTML); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment