Last active
July 14, 2019 17:09
-
-
Save DaveEveritt/0eee0ee91b43a8b41adb2ab3e99f889a to your computer and use it in GitHub Desktop.
A pure JavaScript document.querySelectorAll shortcut
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>A Vanilla JavaScript querySelectorAll shortcut</title> | |
</head> | |
<body> | |
<h1>A querySelectorAll shortcut</h1> | |
<section class="mydiv">a div</section> | |
<section class="mydiv">another</section> | |
<section class="mydiv">yet another</section> | |
<script> | |
const quall = slctr => { return document.querySelectorAll(slctr) }; | |
console.log(quall(".mydiv")); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment