作者热门文章
- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
如何将Jquery表单验证插件中的“此字段为必填项”的一般消息更改为“このフイールドナ必须です”?可以使用以下代码更改消息的颜色:
<style type="text/css">
label.error {color: red;}
</style>
但是如何改变内容呢?
我想更改所有“需要提交此文件”的消息。
我想将所有“必需”消息更改为“このフイールドハ必须です”。
$(".selector").validate({
rules: {
name: "required",
email: {
required: true,
email: true
}
},
messages: {
name: "Please specify your name",
email: {
required: "We need your email address to contact you",
email: "Your email address must be in the format of name@domain.com"
}
}
})
只更改特定规则和特定元素的特定消息。
我写了
messages: {
required:"このフィールドは必須です"
}
但它不起作用。
最佳答案
我尝试了接受的答案,但它对我根本不起作用。我在 Google 上进行了更多搜索,发现 this article .
使用这行代码解决了我的问题:
$.validator.messages.required = "Your new required message here!";
关于javascript - Jquery表单验证插件中如何修改 "This field is required"的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1838695/
我是一名优秀的程序员,十分优秀!