jQuery validation

Download from http://jqueryvalidation.org/

Include
<script src="jquery.validate.js"></script>

<script>
$("#step_1_form").validate({
    rules: {
        email: {
            required: true,
            email: true        }
    },
    messages: {
        email: "Please enter a valid email address",
    },
    submitHandler: function(form) {
        form.submit();    }
});
 </script>

When using the equalTo you have to use the form name and ID. E.g:

<input type="password" name="password" id="password" value="" />
<input type="password" name="password_mirror" value="" />

$("#register_user").validate({
        rules: {
            'password_mirror': {
                minlength: 5,
                equalTo: "#password"
            }
        },
        messages: {
            'password_mirror': {
                minlength: "Your password must be at least 5 characters long",
                equalTo: "Please enter the same password as above"
            }
        }
    });


jquery validation form with ajax loaded form

$(document.body).on('click', '.submitBtn', function(){
    $("#form").validate({
        submitHandler: function() {
            // do anything        }
    });
});