title: jQuery validator and datepicker click not validating
body: <p>I am using jquery validator to validate text inputs. The problem I have is, if I click submit it displays all error message correctly. However, on the datepicker input, to clear the error message I have to select the datepicker twice. ie; 1 click to select and it inputs the data correctly. 2nd click to clear the error message. </p>
  
  <p>I read somewhere about using an 'on' event on the datepicker, so I tried that, but it made no difference. I don't think that is coded correctly. I am assuming that the invalid and success classes are part of the validator script. Worth a try. </p>
  
  <p>What could be happening here. Thanks</p>
  
  <p>Sciprt code</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function() {
          $("#datepicker").datepicker({
              changeMonth: true,
              changeYear: true,
              yearRange: '2011:2037',
              dateFormat: 'dd/mm/yy',
              minDate: 0,
              defaultDate: null
          }).on('changeDate', function(ev) {
      if($('#datepicker').valid()){
         $('#datepicker').removeClass('invalid').addClass('success');   
      }
   });
  
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>html code</p>
  
  <pre><code>&lt;label for"datepicker"&gt;
     &lt;input id="datepicker" name="datepicker" type="text" /&gt;
  &lt;/label&gt;
  </code></pre>
  
  <p>validator relevant code</p>
  
  <p>Rules/Message section</p>
  
  <pre><code> datepicker:
      {
          required: true,
          date: true
      },
  
   datepicker:
      {
          required: " * required: You must enter a destruction date",
          date: "Can contain digits only"
      }
  </code></pre>