/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error {
color: #ff0000;
}
.field-validation-valid {
display: none;
}
.input-validation-error {
background-color: #ffeeee;
border:1px groove;
}
.validation-summary-errors {
font-weight: bold;
color: #ff0000;
}
.validation-summary-valid {
display: none;
}
如何通过成功验证以绿色点亮字段?添加新选项“.input-validation-valid”不帮助。可以用特殊的jQuery插件吗?在此先感谢您的所有帮助
答案 0 :(得分:0)
假设您使用查询验证和不显眼的验证,当字段有效时,将从DOM中删除错误消息,因此没有任何样式!典型的错误会导致此问题(请注意<span>
<span>
<span class="field-validation-error" data-valmsg-for="Account.Description" data-valmsg-replace="true">
<span for="Account_Description" generated="true" class="">Please enter a description</span>
</span>
如果有效,则移除内部范围,类名称更改为“field-validation-valid”
<span class="field-validation-valid" data-valmsg-for="Account.Description" data-valmsg-replace="true"></span>