使用jquery验证插件的有效方法时出错

时间:2018-01-24 04:18:10

标签: javascript jquery jquery-validate

这是我在验证js文件中使用的代码

$(document).ready(function () {

    $("form[name='signupform']").validate({
        rules: {
            firstname: "required",
            lastname: "required",
            email: {
                required: true,
                // Specify that email should be validated
                // by the built-in "email" rule
                email: true
            },
            password: {
                required: true,
                minlength: 5
            }
        },
        // Specify validation error messages
        messages: {
            firstname: "Please enter your firstname",
            lastname: "Please enter your lastname",
            password: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long"
            },
            email: "Please enter a valid email address"
        },

    });

    $("#next").click(function () {
        alert("Valid: " + $("#signupform").valid());
        //  $("input:blank").css("border", "1px solid red");
        console.log("next is working");
    });
});

这是我用过的脚本文件

<script src="https://code.jquery.com/jquery-1.12.4.min.js"  integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="            crossorigin="anonymous"></script>
    <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
    <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
  <script src="~/assets/js/validation.js"></script>

现在我的问题是,当我使用form.valid方法时,它在我的jquery.validation.min.js文件中给出了“无法使用表单属性”的错误

0 个答案:

没有答案