Skip to content

Instantly share code, notes, and snippets.

@chriswrightdesign
Last active June 23, 2017 03:42
Show Gist options
  • Save chriswrightdesign/50342e985cb586d8d719f81e50b34e52 to your computer and use it in GitHub Desktop.
Save chriswrightdesign/50342e985cb586d8d719f81e50b34e52 to your computer and use it in GitHub Desktop.
Toggle visibility - basic event listener
// 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