Skip to content

Instantly share code, notes, and snippets.

@dannycroft
Created October 12, 2012 09:23
Show Gist options
  • Select an option

  • Save dannycroft/3878303 to your computer and use it in GitHub Desktop.

Select an option

Save dannycroft/3878303 to your computer and use it in GitHub Desktop.
Simple dollar selector method
function $(selector) {
try {
return Array.prototype.slice.call(
document.querySelectorAll(selector));
} catch(e){}
return jQuery(selector); //Fallback on another framework
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment