Last active
January 21, 2023 20:12
-
-
Save va9iff/071bf2de71b4b7f5b2df2e21e4e621c4 to your computer and use it in GitHub Desktop.
query with $.class syntax only in 1 line
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
let $ = new Proxy({}, { get: (_, c) => document.querySelector(`.${c}`) }) | |
$.toggleBtn.onclick = e => { | |
$.content.classList.toggle("visible") | |
} | |
$.toggleBtn.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No need to worry about JQuery. Just store it in another variable.