Answers for "how to add 2 listener on the same event"

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
0

adding event listener to multiple elements

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 add 2 listener on the same event"

Code answers related to "Javascript"

Browse Popular Code Answers by Language