1

Is there a way to customize the default message for an invalid rule in jQuery Validate plugin?

I mean something like

whenever a field is required, and I have not specified a custom message, the message should be "custom message"

I have tried this code but without success

$.validator.setDefaults({
    messages: { 
        required: "custom message"
    }
});
Lorenzo
  • 29,081
  • 49
  • 125
  • 222

1 Answers1

4
jQuery.extend(jQuery.validator.messages, {
  required: "custom message",
});
Aivan Monceller
  • 4,636
  • 10
  • 42
  • 69