JQuery validator - custom message?
Hey, i'm using the jquery validator. But i want to have custom message instead of the default 'this field is required'. How can i do that?? My validation currently looks like this:
- $.validator.addMethod("pageRequired", function(value, element) {
var $element = $(element)
function match(index) {
return current == index && $(element).parents("#sf" + (index + 1)).length;
}
if (match(0) || match(1) || match(2)) {
return !this.optional(element);
}
return "dependency-mismatch";
}, $.validator.messages.required)
So if i have an input field i simply add the 'pageRequired' to the class and it works. But it displays the default message which i want to replace. Can someone please tell me how to do that?