Last active
February 6, 2018 18:54
-
-
Save jhafner/30cadb8c424ad094f3aa5c3b2670a8b1 to your computer and use it in GitHub Desktop.
3 lines of code, that make writing pure JS so much quicker. Borrowed mostly from http://jsfiddle.net/leaverou/hRz8K/embedded/result,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
function $(id) { return document.getElementById(id); } | |
function $c(class) { return document.getElementsByClassName(class); } | |
function $t(tag, container) { return (container || document).getElementsByTagName(tag); } | |
function $$(expr, container) { return (container || document).querySelectorAll(expr); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment