Reputation: 45
I'm trying to implement an Input Mask to force a two character entry. If the field is empty, I would like to display a placeholder. This works fine with fields that I do not mask the input, but it does not seem to work with masked inputs. Any other solutions? Here is a snippet of the field:
<dd style="display: none" id="stateEditor">@Html.TextBoxFor(Model => Model.State, new { mask = "aa", htmlAttributes = new { placeholder = "NJ" } })</dd>
Any tips would be appreciated.
Upvotes: 0
Views: 6395
Reputation: 306
You don't need to set placeholder in htmlAttributes. Set placeholder the same as mask attribute. hope, it will help.
<dd style="display: none" id="stateEditor">@Html.TextBoxFor(m => m.State, new { mask = "aa", placeholder = "NJ" })</dd>
Upvotes: 1