我想防止用户重复点击提交按钮。我尝试了一些在stackoverflow上针对类似问题的解决方案。
例如:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js">
$('<% =btnUpload.ClientID %>').click(function () { this.disabled = true });
</script>
我也尝试过...
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js">
$("form").submit(function() {
$(this).submit(function() {
return false;
});
return true;
});
</script>
并且尝试在主页面上进行了测试
<form onsubmit="if(submitted) return false; submitted = true; return true">
但是没有用.. 我仍然能够点击按钮多次。
标记:
<asp:Button ID="btnUpload" runat="server" class="blue-button"
CssClass="ButtonText"OnClick="btnUpload_Click"
OnClientClick="if (!confirm('Are you sure that you want to Save entered details ?'))
return false;return doCustomValidate(event,true);"
Text="Save" />
请注意,我正在使用主页面。
$('#btnUpload')
。 - fnostro