Created
November 10, 2019 01:22
-
-
Save takahirohonda/4c34728d0cb2cc173deaf3486c5cc022 to your computer and use it in GitHub Desktop.
better-way-to-attach-event-listener-with-vanilla-js-3-loop-way.js
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 radioInputs = document.querySelectorAll('.radio-input') | |
for(let input of radioInputs) { | |
input.addEventListener('change', e => { | |
console.log(`${e.target.value} is picked`) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment