I am validating a form with jquery validate and wanted to display error message only to the email field. I tried something like this
messages: {
txtFirstName: '',
txtDob: '',
txtPhone: '',
txtEmail: "Por favor ingrese una dirección de correo válida. Ej: [email protected]",
Privacyid: ''
}
The error messages get displayed at the top, but p tag is getting created for each of the element. I just need to display error message for email alone.
showErrors: function (errorMap, errorList) {
var msg = "<p>Your form contains " + this.numberOfInvalids() + " errors, see details below.</p>"
$.each(errorMap, function(key, value) {
msg += "<p>" + value + "</p>";
});
$("#errormessages").html(msg);
this.defaultShowErrors(); // default labels from errorPlacement
if (this.numberOfInvalids() > 0) {
$("#errormessages").show();
} else {
$("#errormessages").hide();
}
}