title: jQuery form validation on button click
body: <p>I have a simple page with a form and a button outside the form. I am trying to validate the form on the button click.
  I have added the rules for validation of the form on the document.onready function. However the form is not getting validated.  </p>
  
  <p>HTML:-</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
     &lt;script src="lib/jquery1.5.2.js"&gt;&lt;/script&gt;
     &lt;script src="lib/jquery.validate.js"&gt;&lt;/script&gt;
     &lt;script src="lib/myjs.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form id="form1" name="form1"&gt; 
       Field 1: &lt;input id="field1" type="text" class="required"&gt;
  &lt;/form&gt;
  
  &lt;div&gt;
      &lt;input id="btn" type="button" value="Validate"&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>JS:-</p>
  
  <pre><code>$(document).ready(function(){
  
  $("#form1").validate({
     rules: {
       field1: "required"
     },
     messages: {
       field1: "Please specify your name"
  
     }
  })
  
  $('#btn').click(function() {
   $("#form1").validate();  // This is not working and is not validating the form
  });
  
  });
  </code></pre>
  
  <p>Any idea what's wrong?</p>