Last active
July 1, 2024 04:41
-
-
Save Shakil-Shahadat/323e1bdd0d0f7f354b077991641c10b0 to your computer and use it in GitHub Desktop.
[ Delete ] Functions to shorten querySelector* calls in JavaScript
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 qs( cls ) | |
{ | |
return document.querySelector( cls ); | |
} | |
function qsa( cls ) | |
{ | |
return document.querySelectorAll( cls ); | |
} | |
// Examples | |
qs( '.box' ).innerText = 'Hello World!'; | |
qsa( '.box' )[ 0 ].innerText = 'Hello Universe!'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ToDo