Last active
May 1, 2022 06:43
-
-
Save nicoxxxcox/6b6d47074b48fcd0a6a0368c18ed18e2 to your computer and use it in GitHub Desktop.
Javascript function to simple toggle an "active" class on an DOM element
This file contains 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
// 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