开发者

Customize the default message for a rule [duplicate]

This question already has answers here: jQuery validation: change default error message 开发者_运维知识库 (15 answers) Closed 3 years ago.

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"
    }
});


jQuery.extend(jQuery.validator.messages, {
  required: "custom message",
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜