Skip to content

Instantly share code, notes, and snippets.

@SteGriff
Created May 12, 2014 10:08
Show Gist options
  • Save SteGriff/ac2acd90768f6d3cf07a to your computer and use it in GitHub Desktop.
Save SteGriff/ac2acd90768f6d3cf07a to your computer and use it in GitHub Desktop.
Dumb sizzler
function $(x){
return ((x[0]=="#") ? document.getElementById(x.substr(1)) : document.getElementsByTagName(x)[0]);
}
@SteGriff
Copy link
Author

For when you want the convenience of jQuery's Sizzle selector but don't need its full power, and don't want the whole weight of the library behind it. $('#results') gets the element with id='results' and $('h1') gets the first h1 tag in the document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment