-
-
Save ITJoePC/eb0080848e5c4e4ef58335230e26db54 to your computer and use it in GitHub Desktop.
Use querySelector with .bind() as a shortcut to familiar function names
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
// returns first element selected - $('input[name="food"]') | |
var $ = document.querySelector.bind(document); | |
// return array of selected elements - $$('img.dog') | |
var $$ = document.querySelectorAll.bind(document); | |
// Credit: https://twitter.com/wesbos/status/608341616173182977 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment