Last active
June 23, 2017 03:42
-
-
Save chriswrightdesign/50342e985cb586d8d719f81e50b34e52 to your computer and use it in GitHub Desktop.
Toggle visibility - basic event listener
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
// Imagine we had an event listener that would control toggling a visibility class of an element | |
const toggleVisibleClass = event => { | |
console.log(event.target.value + 'changed'); | |
someTarget.classList.toggle('is-visible'); | |
} | |
checkbox.addEventListener('change', toggleVisible, false); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment