其实不少人应该都知道了,这里还是放个备份提个醒。
默认的验证信息都是英文的,如果你想本地化一下,要么替换掉
messages: { required: "This field is required.", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: "Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", number: "Please enter a valid number.", digits: "Please enter only digits.", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", accept: "Please enter a value with a valid extension.", maxlength: $.validator.format("Please enter no more than {0} characters."), minlength: $.validator.format("Please enter at least {0} characters."), rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), range: $.validator.format("Please enter a value between {0} and {1}."), max: $.validator.format("Please enter a value less than or equal to {0}."), min: $.validator.format("Please enter a value greater than or equal to {0}.") },
要么就去
http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/localization/messages_##.js
下一个本地化好的包吧,##是对应的区域代码,对于天朝来说,自然是zh
http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/localization/messages_zh.js
ps.里面其实就是
/* * Translated default messages for the jQuery validation plugin. * Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語) */ jQuery.extend(jQuery.validator.messages, { required: "必选字段", remote: "请修正该字段", email: "请输入正确格式的电子邮件", url: "请输入合法的网址", date: "请输入合法的日期", dateISO: "请输入合法的日期 (ISO).", number: "请输入合法的数字", digits: "只能输入整数", creditcard: "请输入合法的信用卡号", equalTo: "请再次输入相同的值", accept: "请输入拥有合法后缀名的字符串", maxlength: jQuery.validator.format("请输入一个长度最多是 {0} 的字符串"), minlength: jQuery.validator.format("请输入一个长度最少是 {0} 的字符串"), rangelength: jQuery.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"), range: jQuery.validator.format("请输入一个介于 {0} 和 {1} 之间的值"), max: jQuery.validator.format("请输入一个最大为 {0} 的值"), min: jQuery.validator.format("请输入一个最小为 {0} 的值") });
存一个js档在validate后面加载就行了。顺便可以补上上一篇里面提到的日期验证bug。
查看本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/webkf/jquery/
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索jquery
, validate
, validator
, 输入
, jquery.validation
, validation
, valid
, jquery validation
, format
, 一个
, Enter
, enterable
, equalTo
jquery的validation
jquery validation、jquery.validation.js、jqueryvalidation下载、jqueryvalidation.org、jqueryvalidation api,以便于您获取更多的相关知识。