1

我使用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
怎么了?

4

1 回答 1

0

我已经破解extension了验证插件,发现在那个例子中他们使用|而不是,所以尝试使用..

extension: "doc|txt|pdf",
于 2013-05-23T09:25:49.383 回答