我有一些 HTML 有一个label
和input
这样的字段:
<div class="table-cell segmented">
<label for="email" class="field-label">email</label>
<input id="email" name="email" class="required" type="email" placeholder="Required" />
<input type="hidden" id="forgotPasswordInput" name="forgotPasswordInput" value="false"/>
</div>`
当-validation 失败时,我想label
用id
“名称”更改颜色。如果验证失败input
,我不需要更改添加的标签的颜色。input
我有以下方法来验证:
var validator =$("#loginForm").validate({
rules: {
email: {
required:true,
email:true,
emailRule: true,
},
emailPass: {
required:true,
},
},
messages: {
email: {
required:"enter email",
email:"invalid email",
},
emailPass:{
required:"enter password",
},
}
});