Answers for "how to apply an event on many classes"

0

how to apply an event on many classes

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

Code answers related to "how to apply an event on many classes"

Browse Popular Code Answers by Language