I have the following code in my page/view:
@Html.TextBoxFor(x => x.Name, new { maxlength = "50", size = "50" })
The output generated is:
<input id="Name" maxlength="50" name="Name" size="50" type="text" value="" />
I am using the following doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
My page is not validating using the HTML validation tool because of the closing /> of the input element. How do I get the helper to create me an input element looking like:
<input id="Name" maxlength="50" name="Name" size="50" type="text" value="">
I think that html generated by
TextBoxForhelper is correct or at least can be used in any browser, but if you want to create your own helper method, you can add a extension method to theHtmlHelper. For example: