validate
method prevents the default action of the submit
event, when you submit the form the validate
method is called. If you want to submit the form when the form fields are valid, you should define a submitHandler
function on the passed object to the validate
method:
$('#form').validate({
"rules": {
"name": {
"required": true
}
},
submitHandler: function(form) {
form.submit();
}
});
As the form
argument is a raw DOM element, calling it's submit
method doesn't call the validate
method. If you don't want to define the mentioned method you can get the raw DOM element using .get()
method and call it's submit
method:
$('#form').get(0).submit();