title: jquery validate firing unhighlight function imediately after highlight
body: <p>despite my problem is similar <a href="https://stackoverflow.com/questions/22903707/jquery-validate-is-firing-both-highlight-and-unhighlight-in-chrome">with this</a></p>
  <p>the proposed solution did not work for me.
  Let me explain what happens.
  As the title suggests unhiglight is called right after highlight.</p>
  <p>and this happens only under one scenario only:
  <strong>using remote method of email</strong>.
  If the ajax call returns true(after hitting the submit button)(email does not exist) error class is added and immediately replaced by valid class in the fields that are not filled(required)...</p>
  <p>if I hit submit again the problem does not appear...if some fields are not filled error class is attached properly.</p>
  <p>What differentiates first from second submit(and if email is not changed) is the fact  that ajax call for the email is not made.</p>
  <p>So if ajax call is made(for the email) and returns true the above problem appears.
  The code for the showerrors method found in the above Soverflow post does not help.</p>
  <p><strong>I must emphasize that if I remove the remote method for the email the problem is fixed</strong></p>
  <p>here is the code inside validate():</p>
  <pre><code>  $('#bizuserform').validate({
      showErrors: function (errorMap, errorList) {
          var errors = this.numberOfInvalids();
       
          if (errors) {
              
              var message = errors == 1 ? '1 field is miissing!!!' :  errors + ' fields are missing!!!';
             
              $(&quot;#error_general span&quot;).empty().html(message);
              $(&quot;#error_general&quot;).show();
          } else {
              $(&quot;#error_general&quot;).hide();
          }
          this.defaultShowErrors();
      },
      highlight: function(element, errorClass, validClass) {
       
        if($(element).attr(&quot;id&quot;)=='staffclient_yes')
            {
              $('#staffclient_yes').parent().addClass(errorClass);   
            }
          
          
          if($(element).attr(&quot;id&quot;)=='medical')
            {
              $('#medical').parent().addClass(errorClass);   
            }
             $(element).addClass(errorClass).removeClass(validClass);
            },
      unhighlight: function(element, errorClass, validClass) {
            if($(element).attr(&quot;id&quot;)=='staffclient_yes')
            {
              $('#staffclient_yes').parent().removeClass(errorClass);   
            }
             
            if($(element).attr(&quot;id&quot;)=='medical')
            {
              $('#medical').parent().removeClass(errorClass);   
            }
            $(element).removeClass(errorClass).addClass(validClass);
  
           },
      onfocusout: false,
      submitHandler: function(form,event) {
  
        
          event.preventDefault();
        //ajax request here...ommited for brevity
          
            },
   
      rules:{
      name: {
          required: function () {
              return $('#coname').is(':blank');
          },
          normalizer: function( value ) { return $.trim( value );}
      },
      lastname: {
           required: function () {
              return $('#coname').is(':blank');
          },
          normalizer: function( value ) { return $.trim( value );}
      },
      coname: {
            required: function () {
              return $('#name,#lastname').is(':blank');
          },
          normalizer: function( value ) { return $.trim( value );}
      },
      buztype:{required:true 
     },
      med_spec:{
       required: function(element) {return $('#medical').is(':checked');}
        
           },
      password:{
        required:true,
        password:true,
        normalizer: function( value ) { return $.trim( value );}
    },
      address:{ required: true,
      normalizer: function( value ) { return $.trim( value );}
          },
      city:{ required: true,
      normalizer: function( value ) { return $.trim( value );}
          },
      municipality:{ required: true,
      normalizer: function( value ) { return $.trim( value );}
          },
      email:{required: true,
             email: true,
             remote: {
             url: &quot;email_validity.php&quot;,//if I remove the remote method here problem is fixed
             type: &quot;post&quot;
            },
             normalizer: function( value ) { return $.trim( value );}
  
          },
      phone:{required:true,
            normalizer: function( value ) { return $.trim( value );},
            digits: true,
            rangelength: [10, 14]
          
       },
      staff_to_client:{
    required: &quot;#staf_eng:visible&quot;
       }
      },
      messages:{
          buztype:'',
          staff_to_client:'',
          med_spec:'',
          coname:&quot;&quot;,
           name:'',
      lastname:'',
      password:{required:&quot;&quot;
     
       },
  
       address:'',
       city:'',
       municipality:'',
       email:{required:&quot;&quot;,
             email:'not valid email',
             remote:'email allready exists.'
          },
       phone:{required:&quot;&quot;,
       rangelength:'phonenumber messasge.',
       digits:'only digits here'
       },
       staff_to_client:{
    required: &quot;&quot;
       }
   }
      
  });
  </code></pre>