title: Getting error as "setCustomValidity is not a function"
body: <p>I have added validation in my JS which isgiving error as </p>
  
  <blockquote>
    <p>Uncaught TypeError: contactdate.setCustomValidity is not a function. </p>
  </blockquote>
  
  <p>My JS code is as follows:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function contactDateValidation() {
    var contactdate = new Date($('#date1').val()); // or Date.parse(...)
  
    // var contactdate = $("#date1").val();  
    var dateNow = new Date(); // or Date.now()
    if (contactdate &lt; dateNow) {
      contactdate.setCustomValidity('Date cannot be less than todays date');
    } else {
      $("#date1").setCustomValidity("");
    }
  }</code></pre>
  </div>
  </div>
  </p>