Skip to content

Instantly share code, notes, and snippets.

@DaveEveritt
Last active July 14, 2019 17:09
Show Gist options
  • Save DaveEveritt/0eee0ee91b43a8b41adb2ab3e99f889a to your computer and use it in GitHub Desktop.
Save DaveEveritt/0eee0ee91b43a8b41adb2ab3e99f889a to your computer and use it in GitHub Desktop.
A pure JavaScript document.querySelectorAll shortcut
<!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