jQuery Validation plugin "a.validator.methods[d] is und
jQuery Validation plugin "a.validator.methods[d] is undefined"
我想知道如何使用 http://jqueryvalidation.org 中的插件验证文件大小、类型和扩展名。
我正在尝试使<input type="file" name="file">
不是必需的,但我的控制台中得到了一个a.validator.methods[d] is undefined
。如果file:{required:
true
,一切正常。但就我而言,不需要文件。
我有这些文件包括:
<script src="../javascripts/jquery.validation.js"></script>
<script src="../javascripts/jquery.validation.additional.js"></script>
$('#message').validate({
ignore: "",
rules: {
message:{ required: true },
file:{ required:false, accept: "png|jpe?g|gif", filesize: 1048576 }
},
messages:{
message:"Please type your message",
file:{ required:"File is required", accept: "Hello" },
}
});
更新:
我尝试将ignore: ".ignore"
与file:{required:true
一起使用,<input type="file" name="file" class="ignore">
.它仍然在提交时进行验证。如果我file:{required:
设置为 false
,那么我仍然在控制台中收到a.validator.methods[d] is undefined
错误。
看看从文档中忽略。http://jqueryvalidation.org/validate
相关文章:
- Difference between methods of defining JavaScript 'class
- 何时使用Meteor.methods和使用存根
- Class methods in node.js
- Meteor.methods:从内部回调将数据返回给客户端
- Javascript methods: this & that
- 是 init.apply 和 methods[method].apply javascript 行是默认的
- Javascript Magic Methods
- 如何使用 DOM-Methods 在 JavaScript 调用的位置插入文本
- jQuery Validation plugin "a.validator.methods[d] is und
- forEach() and Apply() methods for two dimensional array in J
- Javascript sub-methods
- How to call Polymer element methods in Angular2?
- 为什么.调用String.methods除了在Firefox中不起作用
- 无法在Meteor.methods中设置正确的编辑权限
- pre - flight响应中的Access-Control-Allow-Methods不允许使用PUT方法.在AWS
- Node.js TypeError: Cannot call method 'write' of und
- Android WebView "无法读取property 'getAttribute'und
- Sharing methods and properties between "classes"
- POST and GET methods
- CLI NodeJS(并发、回调、.methods)