我有一个带有 id ( form_select
) 的表单,它有 2 个错误类 (errorIdentification
和errorIdentification1
)。
$('#form_select').validate({
rules: {
'user_name' : {
required: true
},
'password' : {
required: true
}
},
messages: {
'user_name' : {
required: 'From date is required!'
},
'password' : {
required: 'To date is required!'
}
},
errorClass: **'errorIdentification'**,
errorPlacement: function(err, element) {
err.insertBefore(element);
},
submitHandler: function(form) {
form.submit();
}
});
$('#form_select').validate({
rules: {
'from' : {
required: true
},
'to' : {
required: true
}
},
messages: {
'from' : {
required: 'From date is required!'
},
'to' : {
required: 'To date is required!'
}
},
errorClass: **'errorIdentification1'**,
errorPlacement: function(err, element) {
err.insertBefore(element);
},
submitHandler: function(form) {
form.submit();
}
});
问题是在验证表单时,所有字段(用户名、密码、从和到)都得到相同errorIdentification
的错误类,这是(用户名和密码)的第一个错误类
如何使用不同的错误类来实现这一点?