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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -