Skip to content

Instantly share code, notes, and snippets.

@va9iff
Last active January 21, 2023 20:12
Show Gist options
  • Save va9iff/071bf2de71b4b7f5b2df2e21e4e621c4 to your computer and use it in GitHub Desktop.
Save va9iff/071bf2de71b4b7f5b2df2e21e4e621c4 to your computer and use it in GitHub Desktop.
query with $.class syntax only in 1 line
let $ = new Proxy({}, { get: (_, c) => document.querySelector(`.${c}`) })
$.toggleBtn.onclick = e => {
$.content.classList.toggle("visible")
}
$.toggleBtn.click()
@va9iff
Copy link
Author

va9iff commented Jan 21, 2023

No need to worry about JQuery. Just store it in another variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment