Last active
May 2, 2022 16:23
-
-
Save kawsaramin101/4b2eb09aeafd1e4f6a745df5761d9460 to your computer and use it in GitHub Desktop.
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 $(el) { | |
const type = el.charAt(0); | |
switch (type) { | |
case "#": | |
return document.querySelector(el); | |
break; | |
case ".": | |
return document.querySelectorAll(el); | |
break; | |
default: | |
return document.getElementsByTagName(el); | |
} | |
} |
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){switch(e.charAt(0)){case"#":return document.querySelector(e);case".":return document.querySelectorAll(e);default:return document.getElementsByTagName(e)}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment