属性列表后的jquery验证缺失} [英] jquery validation missing } after property list

查看:60
本文介绍了属性列表后的jquery验证缺失}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里有这个代码:

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

并且在此代码中第4行的firebug上的属性列表错误后抛出missing}。为了爱我,我无法弄明白为什么 - 因为我正在通过jquery文档做所有事情。

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

这篇关于属性列表后的jquery验证缺失}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆