0

現在エラーが発生しているjQuery Validateを使用した検証関数があります。

キャッチされていない SyntaxError: 予期しない数です

それでも、コードの何が問題なのかを正確に見つけることができないようです。問題のある行をコメントアウトして削除しようとしましたが、別のエラーしか表示されません

キャッチされていない SyntaxError: 予期しない識別子

私のコード:

<script type="text/javascript">
    $(document).ready(function(){
        $.extend($.validator.messages,{
            equalTo: "Your passwords do not match.",
            remote: "The password you entered is incorrect."
        });

        $('#PasswordChange').validate(function() {
            rules: {
                ChangePassNew: {
                    required: true,
                    minlength: 6 //<-- the line giving the error.
                },
                ChangePassConfirmNew: { //<-- the line giving the new error once the offending line is commented out
                    required: true,
                    minlength: 6
                },
                ChangePassConfirmOld:{
                    required: true,
                    minlength: 6,
                    remote: "verifypass.php"
                },
                messages: {
                    ChangePassNew: {
                        required:"Please enter a password.",
                        minlength:"Please enter at least 6 characters."
                    },
                    ChangePassConfirmNew: {
                        required:"Please enter a password.",
                        minlength:"Please enter at least 6 characters."
                    },
                    ChangePassConfirmOld: {
                        required:"Please enter a password.",
                        minlength:"Please enter at least 6 characters.",
                        remote:"The password you entered is incorrect."
                    },
                },
            },
            submitHandler:function(form){
                form.submit();
            }
        });
    });
</script>

どんな助けでも大歓迎です。

4

1 に答える 1

2

変化する

$('#PasswordChange').validate(function(){

$('#PasswordChange').validate({

関数ではなく、オプションを保持するオブジェクトが必要です。

于 2013-11-11T13:03:50.820 に答える