我有以下内容,如果未填充TextBoxFor,则会导致红色验证消息出现。效果很好,但我希望在TextBoxFor placholder所在的位置出现验证消息。
有没有办法在html内做到这一点?
@Html.TextBoxFor(x => Model.Username, new { type = "email", id = "emailEntry", placeholder = "Email address..", @class = "form-control" })
@Html.ValidationMessageFor(x => Model.Username, "Email address is required", new { @class = "text-danger" })