Get ID of element that called a function

前端 未结 7 633
梦毁少年i
梦毁少年i 2020-12-07 20:02

How can I get the ID of an element that called a JS function?

body.jpg is an image of a dog as the user points his/her mouse around the screen at different

7条回答
  •  轮回少年
    2020-12-07 20:36

    Pass a reference to the element into the function when it is called:

    
    
    
    

提交回复
热议问题