我使用JQuery Validation Plugin来验证我的表单,它适用于所有字段,
但是当我尝试将它用于 <input type="file" id="ProjectInformation">
<script>
$(function() {
$("#feedback-form").validate({
submitHandler: function(form) {
form.submit();
},
rules: {
Name: {
required: true,
minlength: 2
},
ProjectInformation: {
extension: "doc,txt,pdf",
}
},
messages: {
Name: {
required: "Please enter a name",
minlength: "Name must consist of at least 2 characters"
},
ProjectInformation: {
extension: "Only .doc, .txt, and .pdf files allowed",
}
}
});
});
</script>
我收到错误Uncaught TypeError: Cannot call method 'call' of undefined
怎么了?