title: How to validate a login form with jQuery?
body: <p>Can anyone please tell me how to validate a login form with the jQuery Validate plugin?</p>
  
  <p>I tried this code:</p>
  
  <pre><code>    &lt;script src="jquery-1.8.3.js"&gt;&lt;/script&gt;
  &lt;script src="loginbut/js/login.js"&gt;&lt;/script&gt;
  &lt;script src="jquery.validate.js" type="text/javascript"&gt;
  &lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function(){
  $("#loginform").validate({
  rules:{
  //name:"required",
  username:"required",
  
  password:"required",
  gender:"required",
  
  },
  messages:{
  email:"This field cannot be empty",
  
  password:{
  required:"specify password",
  
  },
  
  });
  
  });
  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>and html code as:</p>
  
  <pre><code>&lt;div id="bar"&gt;
      &lt;div id="container"&gt;
          &lt;!-- Login Starts Here --&gt;
          &lt;div id="loginContainer"&gt;
              &lt;a href="#" id="loginButton"&gt;&lt;span&gt;Login&lt;/span&gt;&lt;em&gt;&lt;/em&gt;&lt;/a&gt;
              &lt;div style="clear:both"&gt;&lt;/div&gt;
              &lt;div id="loginBox"&gt;                
                  &lt;form id="loginForm"&gt;
                      &lt;fieldset id="body"&gt;
                          &lt;fieldset&gt;
                              &lt;label for="email"&gt;Username&lt;/label&gt;
                              &lt;input type="text" name="email" id="email" class="required"/&gt;
                          &lt;/fieldset&gt;
                          &lt;fieldset&gt;
                              &lt;label for="password"&gt;Password&lt;/label&gt;
                              &lt;input type="password" name="password" id="password" class="required"/&gt;
                          &lt;/fieldset&gt;
                          &lt;input type="submit" id="login" value="Sign in" /&gt;
                          &lt;label for="checkbox"&gt;&lt;input type="checkbox" id="checkbox" /&gt;Remember me&lt;/label&gt;
                      &lt;/fieldset&gt;
                      &lt;span&gt;&lt;a href="#"&gt;Forgot your password?&lt;/a&gt;&lt;/span&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;!-- Login Ends Here --&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Validation is not working.</p>
  
  <p>Please help me out.</p>