Skip to content

Instantly share code, notes, and snippets.

@kevinweber
Last active December 19, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinweber/c472ac8e8a2a1efeb8762fc1c094599f to your computer and use it in GitHub Desktop.
Save kevinweber/c472ac8e8a2a1efeb8762fc1c094599f to your computer and use it in GitHub Desktop.
MiniJQuery using documentSelectorAll - you don't need jQuery!
// Use this:
var $ = function (domSelector) {
return Array.prototype.slice.call(document.querySelectorAll(domSelector));
}
// Or this:
const $ = (domSelector) => [].slice.call(document.querySelectorAll(domSelector));
// And then use $ like this:
$('div.awesome');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment