开发者

jquery validation missing } after property list

开发者 https://www.devze.com 2023-01-24 23:33 出处:网络
I have this code here: $(\"#order\").validate({ rules: { name: { required: true } lastname: { required: true

I have this code here:

$("#order").validate({
    rules: {
        name: {
            required: true
        }
        lastname: {
            required: true
        }
        address: {
            required: true
      开发者_如何学Python  }
        telephone: {
            required: true
            digits: true
        }
        email: {
            required: true
            email: true
        }
    }
    submitHandler: function (form) {
        debug = true;
        $(form).ajaxSubmit();
        $("#thanks").show(1000);
        $("#datadiv").hide(500);
    }
});

and it throws "missing } after property list" error on firebug on line 4 in this code. And for the love of me, I can't figure out why - because I'm doing everything by jquery documentation.


You need to put commas in between properties of an object literal you are defining. For example:

name: { required: true },  // <-- note the comma
lastname: { required: true },
address: { required: true },
//etc
0

精彩评论

暂无评论...
验证码 换一张
取 消