Jquery validation is not working. Jquery - Javascript
<p>My problem is with the validation of my form using Jquery. My validation was working good with the <code>validate</code> function only but then I added the <code>submit</code> option and the validation is not taking place. I would like to validate my form and then execute the submit. </p>

<pre><code>$(document).ready(function () {
    $('#ReqCreateForm').validate({
         invalidHandler: function (e, validator) {
            var errors = validator.numberOfInvalids();
            if (errors) {
                var message = errors == 1
                ? 'Missing 1 field'
                : 'Missing fields';
                $("div.error span").html(message);
                $("div.error").show();
            } else {
                $("div.error").hide();
            }
        },
        onkeyup: false,
        highlight: function (element) {
            $(element).addClass('error');
        }, unhighlight: function (element) {
            $(element).removeClass('error');
        }
    });

    $('#ReqCreateForm').submit(function () {
        $.ajax({
            url: this.action,
            type: this.method,
            data: $(this).serialize(),
            success: function (result) {
                alert("All Great!");
            },
            error: function (jqXhr, textStatus, errorThrown) {
                alert("Error '" + jqXhr.status + "' (textStatus: '" + textStatus + "', errorThrown: '" + errorThrown + "')");
            }
        });
        return false;
    });
});
</code></pre>

<p>Thanks in advanced. </p>

<p><strong>Solution:</strong></p>

<p>The solution was very simply. Added the following code to my submit option, before <code>$.ajax</code>.</p>

<pre><code>  if (!$(this).valid()) {
         return false;
    }
</code></pre>
