title: Unable to validate while submitting form using jquery
body: <p>I have created a form validation using jQuery. I have a problem while submitting the form. I am able to do validation of required fields only. After required field validation it automatically submitted the form, but I want to do with email field validation, alphabet validation such a things and all.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>$(document).ready(function(){
    $('#userform').validate({
      rules: {
          firstname: "required",
          lastname: "required",
          sex: "required",
          qualification: "required",
          email: "required",
          password: "required",
      },
      messages: {
          firstname: "Please enter your first name",
          lastname: "Please enter your last name",
          sex: "select gender",
          qualification: "select qualification",
          email: "enter valid email id",
          password: "Password must be required"
  
      },
      submitHandler: function(form) {
  
          $txtfname = $('#txtfname').val()
          $txtlname = $('#txtlname').val()
          $txtemail = $('#txtemail').val()
          $txtpasswd = $('#txtpasswd').val()
          $txtcpasswd  = $('#txtcpasswd').val()
          if(!($txtfname.match(/^[a-zA-Z\s]+$/)))
          {
              $('.errfname').text("only alphapets");
          }
          else
          {
              $('.errfname').text("");
          }
  
          if(!($txtlname.match(/^[a-zA-Z\s]+$/)))
          {
              $('.errlname').text("only alphapets");
          }
          else
          {
              $('.errlname').text("");
          }
  
          $valemail = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
          if($valemail.test($txtemail))
          {
              $('.erremail').text("");
          }
          else
          {
              $('.erremail').text("Invalid email address");
          }
  
          if($txtpasswd != $txtcpasswd)
          {
              $('.errcpasswd').text("Password doesn't match");
          }
          else
          {
              $('.errcpasswd').text("");
          }
          form.submit();
      }
  
  
  
    });
  
  
   });
  </code></pre>
  
  <p>Can anyone help me to do this. Thanks in advance</p>