Last active
March 29, 2019 18:56
-
-
Save DaveEveritt/3637aba83d2414378212d210a99aca72 to your computer and use it in GitHub Desktop.
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
const [...elArray] = document.getElementsByClassName('class-name'); | |
elArray.forEach( (el) => { | |
el.addEventListener("click", function() { | |
el.classList.toggle('some-class'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment