Data Attributes for editor for not working.
@Html.EditorFor(model => model.SireTag, new { data_typeahead = "dsfsdfsd" })
When i open my chrome browser i cant see any data-attribute for my text box. I tried goggling and have not found any thing useful.
Actually you can use EditorFor and send additional HTML attributes. Use this overload and set the additionalViewData
parameters. It expects an object with a htmlAttributes
property:
@Html.EditorFor(
model => model.SireTag,
new {
htmlAttributes = new { data_typeahead = "dsfsdfsd" }
}
)
This will generate something like:
<input id="SireTag" name="SireTag" ... data-typeahead="dsfsdfsd">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With