gpt4 book ai didi

javascript - Jquery 验证插件更改默认消息

转载 作者:行者123 更新时间:2023-12-01 02:44:41 25 4
gpt4 key购买 nike

如何更改 Jquery 验证插件中的默认 require 消息。我已尝试以下操作,但它仍然打印默认消息:

$("#form1").validate({
ignore: [],
debug: false,
rules: {
firstName: {
required: true,
minlength: 2,
maxlength: 200
}
message: {
firstName:{
required: "Custom error message."
}
}
}
});
});

更新

我将我的消息更改为消息

 messages: {
firstName:"Custom error message."
}

最佳答案

$("#form1").validate({
ignore: [],
debug: false,
rules: {
firstName: {
required: true,
minlength: 2,
maxlength: 200
},
messages: {
firstName:{
required: "Firstname required",
minlength: "Min length is 2",
maxlength: "Max length is 200",
}
}
}
});

关于javascript - Jquery 验证插件更改默认消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47323305/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com