Is it possible to display the error message above the form like this with jQuery Validation Plugin?
I'm doing something like this, but it shows how many fields are invalid. I'm new with jQuery validation and learing so I don't have any idea about this.
$("#addQ").validate({
invalidHandler: function(form, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
$("#error-message").show().text("You missed " + errors + " field(s)");
} else {
$("#error-message").hide();
}
}
});
Thanks.
You would use
showErrors
instead of theinvalidHandler
to do something like this...OR with field names:
http://jsfiddle.net/hauv7y0a/