Last active
August 9, 2019 21:26
-
-
Save jeangontijo/3c192ef8b529f4facd89b9473f0e3fbe to your computer and use it in GitHub Desktop.
Micro JQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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