title: ASP.NET MVC - How to prevent double click submit with jquery.validate.unobtrusive lib?
body: <p>I need to avoid the double click submitting behavior. I'm using the client validation with the unobtrusive library. I have the following code for avoiding the double clic:</p>
  
  <pre><code>jQuery.fn.preventDoubleSubmit = function () {
           var alreadySubmitted = false;
           return jQuery(this).submit(function () {
  
               if (alreadySubmitted)
                   return false;
               else {
                   alreadySubmitted = true;
               }
           });
       };
  
       jQuery('form').preventDoubleSubmit();
  </code></pre>
  
  <p>Unfortunately, if my form has some validable fields (for example, a required field), the code above is still being fired, hence, even if I correct any mistakes on the form, I won't be able to submit it again.</p>
  
  <p>How can I fire the double click code after the validation has been succesfully done?</p>