What is the best way to limit the amount of text that can be entered into a 'textarea'?

前端 未结 6 643
生来不讨喜
生来不讨喜 2021-01-19 05:50

What is the best way to limit the amount of text that a user can enter into a \'textarea\' field on a web page? The application in question is ASP .NET, but a platform agnos

6条回答
  •  庸人自扰
    2021-01-19 06:21

    The most user-friendly idea seems to me a solution like the Twitter-one. Provide a visual indication that the user has crossed the maximum but don't limit him in typing.

    Whatever Javascript you use, you will still have to validate at the server end. Users with Javascript disabled will otherwise be able to circumvent your limit.

提交回复
热议问题