cucuru cucuru - 1 month ago 14
jQuery Question

jQuery Validate, how to know when it's valid?

I have a form, and I would like to know if it validates while not submitting it. I need the value.

var validation = $(idFormulario).validate({
errorClass: 'jqInvalid',
errorPlacement: function (error, element) {
return false;
},
success: function(e){
return false; //not submit
}
});


It doesn't work. How can I check if form is valid?

Answer

As mentioned in the above comment you've to use valid().

Description: valid() Checks whether the selected form is valid or whether all selected elements are valid.

Example :

$(idFormulario).valid();

Hope this helps.