Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created May 14, 2013 20:52
// Based on https://github.com/james2doyle/saltjs
window.$ = function(s) {
try {return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName',
'?': 'querySelectorAll'
}[s[0]]](s.slice(1));}catch(e){}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment