How to add event listener for html class?

后端 未结 5 812
旧巷少年郎
旧巷少年郎 2021-01-12 01:14

If I have HTML like this:

5条回答
  •  旧时难觅i
    2021-01-12 01:39

    You have class="previewBulk" and document.getElementsByClassName("preview");

    Your code assumes there will be as many elements of the class preview as there are for movieImg, but since you got the class name wrong, there are going to be zero such elements.

提交回复
热议问题