Reputation: 18127
I am trying to disable autocomplete feature in browser and put autocomplete="off" attribute on Input. I have tried to use code below but it do not put autocomplete="off" on generated Input html tag. What is the correct way to do this?
@Html.EditorFor(model => model.ConfirmPassword, new { autocomplete = "off" })
Upvotes: 3
Views: 3471
Reputation: 293
<form name="form1" id="form1" method="post" autocomplete="off"
action="http://www.example.com/form.cgi">
Upvotes: 3
Reputation: 16204
@Html.EditorFor
doesn't take an object htmlAttributes
as a second argument (or any argument for that matter).
Try using @Html.TextBoxFor
instead:
@Html.TextBoxFor(model => model.ConfirmPassword, new { autocomplete = "off" })
Upvotes: 7