jQuery 验证语法错误
jQuery Validation syntax error
我在网上找到了一个脚本,并进行了编辑以适合我的文本字段,但在我的代码编辑器中,它突出显示了最后一行,但有一行是语法错误。因为我是 jquery 代码的新手,所以我很难解决它
$(document).ready(function () {
$('#form_reigs').validate({ // initialize the plugin
rules: {
firstname: {
required: true,
},
lastname: {
required: true,
minlength: 5
},
email2: {
required: true,
email: true
},
password2: {
required: true,
minlength: 5
},
password23: {
required: true,
minlength: 5
}
},
messages :{
"firstname" : {
required : 'Please enter your firstname',
"lastname" : {
required : 'Please enter your lastname',
"password2" : {
required : 'Please enter your password',
"password23" : {
required : 'Please re-type your password',
}
}
});
});
任何帮助
您的 messages
中缺少括号
$(document).ready(function () {
$('#form_reigs').validate({ // initialize the plugin
rules: {
firstname: {
required: true,
},
lastname: {
required: true,
minlength: 5
},
email2: {
required: true,
email: true
},
password2: {
required: true,
minlength: 5
},
password23: {
required: true,
minlength: 5
}
},
messages: {
"firstname": {
required: 'Please enter your firstname',
},
"lastname": {
required: 'Please enter your lastname',
},
"password2": {
required: 'Please enter your password',
},
"password23": {
required: 'Please re-type your password',
}
}
});
});
我在网上找到了一个脚本,并进行了编辑以适合我的文本字段,但在我的代码编辑器中,它突出显示了最后一行,但有一行是语法错误。因为我是 jquery 代码的新手,所以我很难解决它
$(document).ready(function () {
$('#form_reigs').validate({ // initialize the plugin
rules: {
firstname: {
required: true,
},
lastname: {
required: true,
minlength: 5
},
email2: {
required: true,
email: true
},
password2: {
required: true,
minlength: 5
},
password23: {
required: true,
minlength: 5
}
},
messages :{
"firstname" : {
required : 'Please enter your firstname',
"lastname" : {
required : 'Please enter your lastname',
"password2" : {
required : 'Please enter your password',
"password23" : {
required : 'Please re-type your password',
}
}
});
});
任何帮助
您的 messages
$(document).ready(function () {
$('#form_reigs').validate({ // initialize the plugin
rules: {
firstname: {
required: true,
},
lastname: {
required: true,
minlength: 5
},
email2: {
required: true,
email: true
},
password2: {
required: true,
minlength: 5
},
password23: {
required: true,
minlength: 5
}
},
messages: {
"firstname": {
required: 'Please enter your firstname',
},
"lastname": {
required: 'Please enter your lastname',
},
"password2": {
required: 'Please enter your password',
},
"password23": {
required: 'Please re-type your password',
}
}
});
});