Answers for "how to get event listeners in javascript to listen to multiple inputs"

11

add event listener to multiple element in JS

document.querySelectorAll('.some-class').forEach(item => {
  item.addEventListener('click', event => {
    //handle click
  })
})
Posted by: Guest on August-07-2020

Code answers related to "how to get event listeners in javascript to listen to multiple inputs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language