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
  • 28,661
  • 47
  • 120
  • 216

1 Answers1

4
jQuery.extend(jQuery.validator.messages, {
  required: "custom message",
});
Aivan Monceller
  • 4,391
  • 9
  • 39
  • 69