问题
I have this code here:
$("#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);
}
});
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.
回答1:
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
来源:https://stackoverflow.com/questions/4146732/jquery-validation-missing-after-property-list