I am using jQuery validation plugin and have defined a form validation function as shown below. Based on some user action I am running a custom JS function and in that function I just want to check whether the email and phone fields are valid. But I don't want to validate them i.e. I don't want to show the validation errors, I just need to check if their value is valid.
Something like
$('#email').isvalid();
I have checked out the element method of Validator but that validates the element rather than just checking if it's value is valid. So In other words I am looking for a way to run the rules programmatically. Any help is appreciated!
Form validator function below:
var validator = $("#olForm").validate({
rules: {
"email": {
required: true,
email: true
},
"phone": {
required: true,
digits: true,
minlength: 9,
maxlength: 11
}
}
});