2

这可能是一个非常简单的问题,但我只是在学习 jquery,我可能犯了一个非常初学者的错误。我在一个基本的订单表单上设置了验证,但是当我尝试使用 submitHandler: 提交表单时,一些浏览器挂起并且什么也不做,而另一些浏览器会搅动一两分钟然后实际提交。这是 jquery 脚本位:

<script type="text/javascript">
$.validator.setDefaults({
    submitHandler: function () { $("#order").submit(); }
});
$().ready(function () {

   // validate signup form on keyup and submit
    $("#order").validate({
        rules: {
            lastname: "required",
            firstname: "required",
            confirm_email: {
                required: true,
                equalTo: "#email"
            },
            email: {
                required: true,
                email: true
            },
            password: {
                required: true,
                minlength: 5
            },
            confirm_password: {
                required: true,
                minlength: 5,
                equalTo: "#password"
            },
            domain: "required",
            selpackage: "required"
  //       agree: "required"
        },
        messages: {
            firstname: "Please enter your first name",
            lastname: "Please enter your last name",
            password: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long"
            },
            confirm_password: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long",
                equalTo:   "Passwords do not match"
            },
            email: "Please enter a valid email address",
            confirm_email: "Email addresses do not match"
//         agree: "Please accept our policy"
        }
    });

});
</script>

表单名称是 order,它只是一个常规标签。有人能指出我正确的方向吗?

4

0 回答 0