title: jQuery Validation plugin and ASP.NET validators Web Forms
body: <p>I would really like use the <a href="http://plugins.jquery.com/project/validate" rel="nofollow noreferrer">jQuery Validation plugin </a> in my ASP.NET Web Forms application (not MVC).</p>
  
  <p>I value jQuery validation for the Richer UI experience I can provide the end user and I have some requirements to highlight the invalid fields using a red border (css).</p>
  
  <p>I value asp.net validators because they run the validations not only on the client but on the server so that I don't open various security vulnerabilities to any user who is clever enough to turn off javascript in their browser.</p>
  
  <p>So I am looking for a nice clean way to integrate these two technologies.</p>
  
  <p>The best I can come up with is to have all ASP.NET validators set to enableclientscript=false and repeat the validation rules on the client in jQuery and on the server as asp.net validators but I can already see some challenges with this approach.</p>
  
  <p>In the end I found the lowest friction way to achieve highlighting with asp.net validators and  jquery was not to use the jQuery Validation plugin but to use the simple line of jquery which follows (note that the exact syntax will vary depending on how you layout your forms):</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  
  
          $("input[@type=submit]").click(function() {
          $('span.validationerror:hidden').parent().parent().find('input').removeClass('inputError');
          $('span.validationerror:visible').parent().parent().find('input').addClass('inputError');                        
  
          });
  
  &lt;/script&gt;
  </code></pre>