JavaScript - onClick to get the ID of the clicked button

前端 未结 16 1455
名媛妹妹
名媛妹妹 2020-11-22 05:44

How do find the id of the button which is being clicked?


16条回答
  •  悲哀的现实
    2020-11-22 06:30

    You need to send the ID as the function parameters. Do it like this:

    
    
    
        
    

    This will send the ID this.id as clicked_id which you can use in your function. See it in action here.

提交回复
热议问题