title: How to validate a date field in Jquery
body: <p>I want to validate the field so that cannot be greater than today's date. I tried it like this but i dont know how to call this function to validate the date:</p>
  
  <pre><code>jQuery.validator.addMethod( "greaterThan", function( value, element ) { 
  
      var now=new Date(); 
  
      if ( !/Invalid|NaN/.test(new Date(value)) ) { 
  
          return new Date(value) &gt; now; 
  
      } 
  
      return isNaN(value) || (parseFloat(value) &gt; now); 
  
  }, 
  'should not be greater than {0}.' );
  </code></pre>