当我试图隐藏文本框中的验证消息时,它没有隐藏,请你帮帮我
<div class="col-md-10">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control", @autocomplete = "off", onclick = "clearValidation()" })
@Html.ValidationMessageFor(m => m.Email, "", new { @style = "color:white; font-weight:normal; margin-left:-155px;" })
</div>
<script>
function clearValidation() {
document.getElementsByClassName("validation-summary-errors").style.color = "#ff0000";
}
</script>
答案 0 :(得分:0)
使用此 -
$.fn.clearValidation= function () {
$(this).each(function() {
$(this).find(".field-validation-error").empty();
$(this).trigger('reset.unobtrusiveValidation');
});
};