Answers for "how to add an event listener to all inputs of a class"

11

event listener to elements with class

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 add an event listener to all inputs of a class"

Code answers related to "Javascript"

Browse Popular Code Answers by Language