The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.javascript
From: "Álvaro G. Vicario" <alvaroNOSPAMTHA...@demogracia.com>
Date: Fri, 09 May 2008 14:57:10 +0200
Local: Fri, May 9 2008 8:57 am
Subject: Re: Limit <textarea> length without losing caret position
Laser Lips escribió:
> <script type="text/javascript"> It's an idea but it needs quite polishing: in Firefox, once you hit the > function cutLength(e,el,max) > { > if(el.value.length>max) > { > return false; > }else{ > return true; > } > } [...] > <textarea onkeypress="return cutLength(event,this,100)"></textarea> -- [...] > ...How ever, this wont stop people cutting and pasting in over the > limit, it will only stop people when typing normally. limit you can't use the arrow keys or delete with keyboard. And the clipboard issue would be a problem :( Anyway, thanks for the hint. I can think of two approaches: 1. Listening to textarea events: if an event will result in value being 2. Good old "if value too large then cut value" with caret position Both look like a lot of work.. *gasp* -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||