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

Posted by Jesse Taber on Stack Overflow See other posts from Stack Overflow or by Jesse Taber
Published on 2008-12-18T15:57:02Z Indexed on 2011/11/23 1:50 UTC
Read the original article Hit count: 362

Filed under:
|
|

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 agnostic answer is preferred.

I understand that some amount of javascript is likely needed to get this done as I do not wish to actually perform the 'post' with that amount of data if possible as ASP .NET does have an upper limit to the size of the request that it will service (though I don't know what that is exactly).

So maybe the real question is, what's the best way to do this in javascript that will meet the following criteria:

-Must work equally well for both users simply typing data and copy/paste'ing data in from another source.

-Must be as '508 compliance' friendly as possible.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript