jQuery Validation Without Form Submit

Short tutorial on how to submit a form without the submit button. This is using the valid function within the jquery validate plugin

This is an example on how to submit a form without actually clicking on the submit form. Useful in many applications.

This is using the jQuery Validation Plugin.

$(document).ready(function() {
    $("#test").validate({  // initialize plugin on the form
         rules: {
         ...
         }
         ...
         // etc.
    });

    $(".next").click(function(){  // capture the click
        if($("#test").valid()){   // test for validity
            // do stuff if form is valid
        } else {
            // do stuff if form is not valid
        }
    });
});



.validate() is what initializes the Validation plugin on your form.

.valid() returns true or false depending on if your form is presently valid.

 

Learn More: https://stackoverflow.com/questions/12098103/need-jquery-validate-without-submit