Skip to content

Instantly share code, notes, and snippets.

@ryanmcgrath
Created September 2, 2011 08:17
Show Gist options
  • Save ryanmcgrath/1188164 to your computer and use it in GitHub Desktop.
Save ryanmcgrath/1188164 to your computer and use it in GitHub Desktop.
Mobile friendly easy as pie $().
var $ = window.$ = function $(selector) {
if(/^#[a-zA-Z_\-]+$/.test(selector))
return document.getElementById(selector.substr(1, selector.length));
return Array.prototype.slice.call(document.querySelectorAll(selector));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment