按钮触发两次点击事件 [英] button firing click event twice

查看:104
本文介绍了按钮触发两次点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎有时(但并非总是)我的按钮单击事件被触发了两次.似乎有时但并非总是发生的事实确实让我感到困惑.这是我的按钮:

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 my button :

<button id="btnSave" onserverclick="btnAddUser_Click" name="btnSave" type="submit" style="font-size:11px;font-family:Verdana;font-weight:bold;" runat="server">Save</button>

推荐答案

我遇到了同样的问题,花了我一段时间才弄清楚!如果将type ="button"添加到按钮中,似乎可以解决此问题.

I had the same problem, and it took me a while to figure it out! If you add type="button" to your button, it seems to fix the issue.

这篇关于按钮触发两次点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆