aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Maxlength for textarea  not being set properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Maxlength for textarea  not being set properly" Watch "Maxlength for textarea  not being set properly" New topic
Author

Maxlength for textarea not being set properly

K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
I have the current function to limit the amount of characters allowed in a text area:



My problem is that if I set it for "150", I get "151". From testing, it looks like it's not recognizing the first character space and starts the count at the #2 space in the text area.

Any thought?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are starting at index 0 and ending at 150. Subtract 1 from the end.

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Maxlength for textarea not being set properly
 
Similar Threads
issue with a textbox on firefox.
how to avoid copy pasting characters above the set limit in a text area.
text area character limit code without trimming
Maximum number of lines in textarea
problem in validating text area max length