Search code examples
htmlhtml-helper

How to limit the number of characters in @Html.TextArea?


Having this line of code:

@Html.TextArea("userInput")

How to limit the number of characters in the userInput ?


Solution

  • This should work.

    @Html.TextArea("userInput",new { maxlength=50 })