Reputation: 683
Hi I am trying to convert the text entered in textbox to uppercase, but I am not getting the output,please help.
@Html.TextBoxFor(model => model.PanNumber, new { @class = "form-control", @onkeyup = "InputToUpper(this);" })
Upvotes: 0
Views: 3610
Reputation: 19
if you are using "@editorfor" text box then try
@Html.EditorFor(model => model.PanNumber.Alias, new {
htmlAttributes = new { @class = "upper-case" }
})
Upvotes: 0
Reputation:
This should work (remove @onkeyup = "InputToUpper(this);"
from the TextBoxFor
method)
$('#PanNumber').keyup(function() {
var text = $(this).val();
$(this).val(text.toUpperCase());
});
Upvotes: 4