title: ASP.NET MVC: Disable Submit button if Client Validation passes
body: <p>I have a simple MVC4 form with <strong>Client Validation</strong> enabled:</p>
  
  <pre><code> @{ Html.EnableClientValidation(); }
   @{ Html.EnableUnobtrusiveJavaScript(); }
   @using (Html.BeginForm("Search", "Search", FormMethod.Post, new { id = "frmMain" }))
      {
        @Html.AntiForgeryToken() .....
        &lt;input type="submit" value="Search" id="btnSubmit" /&gt;
  </code></pre>
  
  <p>When the user clicks the submit <strong>and all validation passes on the client</strong>, I wish to have the submit button disabled as per jQuery below. How do I know if the validation has passed client side in side my jQuery script?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(document).ready(function () {
      $('input[type=submit]').click(function (e) {
          $(this).attr('disabled', true);
          $(this).attr('value', 'Working');
          $('#frmMain').submit();
      });
  });
  </code></pre>
  
  <p></p>