Skip to content

Instantly share code, notes, and snippets.

@jeangontijo
Last active August 9, 2019 21:26
Show Gist options
  • Save jeangontijo/3c192ef8b529f4facd89b9473f0e3fbe to your computer and use it in GitHub Desktop.
Save jeangontijo/3c192ef8b529f4facd89b9473f0e3fbe to your computer and use it in GitHub Desktop.
Micro JQuery
function $(e){
let el = document.querySelectorAll(e.toString());
if (el.length > 1) {
return el;
} else {
return document.querySelector(e.toString());
}
}
$('#element').classList.add('active');
$('.element').forEach(function(e){
e.classList.add('active');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment