title: Validating Jquery autocomplete field using jquery validation plugin
body: <p>I am not so good with jquery and hence need your help.</p>
  
  <p>I have a form in which there are two fields "origin" and "destination". So I am using the jquery autocomplete for both the fields.</p>
  
  <pre><code>$('#form1_origin,#form1_destination').autocomplete({
          lookup: countriesArray,
          minChars: 0,
      });
  </code></pre>
  
  <p>It works great but when I am trying to validate these fields using jquery validation plugin, I get some problems.</p>
  
  <p>Here is the code:-</p>
  
  <pre><code>$('#form_1').validate({
      errorClass: "airError",
      focusInvalid: true,
      success: function(element){
          $(element).closest('.airError').removeClass('.airError');
      },
      errorPlacement: function(error,element){
          if(element.attr("name") === "form1_infant" || element.attr("name") === "form1_departure"){
              error.insertAfter('#showErrors');
          }else{
              error.insertAfter(element);
          }
      },
      rules: {
      form1_origin: {
          validSelectionOrigin: true,
      },
      form1_destination:{
          validSelectionDestination: true,
          compare_origin_dest: true
      },
      // rules for  rest of the fields
      },
  });
  </code></pre>
  
  <p><strong>Problem:-</strong></p>
  
  <p>As I am pretty sure that jquery validates the fields on <strong>onkeyup</strong>. So If I <strong>TYPE</strong> the value in this field, it works fine but when I select the value from the autocomplete list, It does not validate the field as I can still see the error being displayed. So what can i do to make it work for both ??</p>