title: Validation does not work on click of submit : jquery
body: <p>I am knew to JQuery and I am trying to validate a simple form to start with.</p>
  
  <p>The problem here is the validation does not work on click of submit. Instead I get error message :</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>$(document).ready(function () {
      $("#form").validate({
          rules: {
              "name": {
                  required: true,
                  minlength: 5
              },
              "email": {
                  required: false,
                  email: true
              }
          },
          messages: {
              "name": {
                  required: "Please, enter a name"
              },
              "email": {
                  required: "Please, enter an email",
                  email: "Email is invalid"
              }
          },
          submitHandler: function (form) { // for demo
              alert('valid form submitted'); // for demo
              return false; // for demo
          }
      });
  
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form id="form" method="post" action="#"&gt;
      &lt;label for="name"&gt;Name&lt;/label&gt;
      &lt;input type="text" name="name" id="name" /&gt;
      &lt;label for="email"&gt;Email&lt;/label&gt;
      &lt;input type="email" name="email" id="email" /&gt;
      &lt;button type="submit"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is the jsfiddle: <a href="https://jsfiddle.net/aimanpanday87/hsdscmcj/" rel="nofollow noreferrer">https://jsfiddle.net/aimanpanday87/hsdscmcj/</a></p>