Javascript click event listener on multiple elements and get target ID

前端 未结 6 1312
轻奢々
轻奢々 2020-12-01 22:06

I have a javascript file that sets an EventListener of \'click\' on every element with the

tag. I want to get the id of the article clicked when
6条回答
  •  感情败类
    2020-12-01 22:24

    getElementsByTagName returns a nodelist. You can then add an eventlistener to each one of those elements with a for loop.

    hey
    yo

提交回复
热议问题