button firing click event twice

后端 未结 14 2115
忘了有多久
忘了有多久 2021-02-07 21:28

It seems that sometimes (but not always) my button click event is being fired twice. The fact that it seems to happen sometimes but not always is really puzzling me. Here is m

14条回答
  •  一向
    一向 (楼主)
    2021-02-07 21:55

    It is because the button type is submit. You need to change it to button to solved the button events triggering twice. Refer this blog for further explanation.

    https://mzulkamal.com/blog/asp-net-web-form-html-button-tag-fires-two-times-s

提交回复
热议问题