If you take a look at this bootstrap documentation for formhelpers, I can use
<input type="text" class="form-control bfh-phone" data-format="+1 (ddd) ddd-dddd" placeholder="Cell or Home Phone" required>
to format a textbox when a user enters a phone number. I want to use an @Html.TextBoxFor or an @Html.EditorFor to do the same thing. How do I accomplish this in mvc? Here is what I have tried:
<input type="text" class="form-control bfh-phone" data-format="+1 (ddd) ddd-dddd" value="@Model.PhoneNumber" placeholder="Cell or Home Phone" required>
and
@Html.EditorFor(model => model.PhoneNumber, new { htmlAttributes = new { @class = "form-control bfh-phone", @placeholder = "Cell or Home Phone", @data-format="+1 (ddd) ddd-dddd" } })
both of which gives a object reference razor syntax error. How is this done?