Skip to content

Instantly share code, notes, and snippets.

@nicoxxxcox
Last active May 1, 2022 06:43
Show Gist options
  • Save nicoxxxcox/6b6d47074b48fcd0a6a0368c18ed18e2 to your computer and use it in GitHub Desktop.
Save nicoxxxcox/6b6d47074b48fcd0a6a0368c18ed18e2 to your computer and use it in GitHub Desktop.
Javascript function to simple toggle an "active" class on an DOM element
// on single element version
const toggleActiveClass = (elem) => elem.classList.toggle("active")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment