How to pass the button value into my onclick event function?

后端 未结 5 2031
失恋的感觉
失恋的感觉 2020-12-24 13:12
test

The dosomething function evoked when to click the button,how can pa

5条回答
  •  有刺的猬
    2020-12-24 13:47

    You can pass the value to the function using this.value, where this points to the button

    
    

    And then access that value in the function

    function dosomething(val){
      console.log(val);
    }
    

提交回复
热议问题