asp.net - How to use a jquery function for multiple buttons -
i have jquery function used prevent double clicks on button , works well. want use same function other button on other tab (same page). tried couple ways , doesn't work. here code jquery:
var issubmitted = false; function preventmultiplesubmissions() { if (!issubmitted) { $('#<%=cmdsave1.clientid %>').val('submitting.. please wait..'); issubmitted = true; return true; } else { return false; }
my .aspx page:
<asp:button id="cmdsave1" runat="server" cssclass="button" text="save" onclientclick="return preventmultiplesubmissions();" onclick="cmdsaveemergency_click"></asp:button> <asp:button id="cmdsave2" runat="server" cssclass="button" text="save" onclientclick="return preventmultiplesubmissions();" onclick="cmdsaveemergency_click"></asp:button>
i tried put in like:
$('#<%=cmdsave1.clientid %>', '#<%=cmdsave2.clientid%>') .val('submitting.. please wait..');
and doesn't work.
any appreciated. thanks
you find submit buttons using jquery , apply logic below.
$(document).on('submit', 'form', function () { var button = $(this).find('input[type="submit"]'); settimeout(function () { showprogress(); button.attr('disabled', 'disabled'); }, 0); });
Comments
Post a Comment