It's step 7 that would give you lots of trouble! floating the div around the last character of the text area, a bunch of math that would depend on the font size, the wrapping and the width of each letter and the number of returns, ouch!
Then there's step 8, convincing the users that the floating div is actually cool! a much simpler statically located div, with a textarea that grows as they approach the limit would be greeted more favorably by most users! When I type, I don't like too many things to be going on around me, even a counter would keep me checking the length of text I had typed. I'd have trouble rambling on and on... but I guess I'm just rambling on without a counter! :) On 4/19/07, Ariel Jakobovits <[EMAIL PROTECTED]> wrote:
This would be easy, here are the steps: 1. identify what event to listen to when trying to respond to key typing in a textarea // one minute 2. create a jQuery function to select that textarea by id // one line 3. bind on that textarea, to that event type, a function that says 'hi' // one line 4. edit that function to alert the current value of the textarea (think 'this') // same line, about 10-20 chars 5. edit that function to alert the length of that value // add 7 chars 6. edit that function to append that value and whatever text you want to the current value of the textarea // some more chars BTW, I think it would be nicer if you put the note about length below or beside the textarea not within, because then you have to worry about removing it before submission, and it looks nicer. ----- Original Message ---- From: Dug Falby <[EMAIL PROTECTED]> To: jquery-en@googlegroups.com Sent: Thursday, April 19, 2007 3:44:16 PM Subject: [jQuery] manipulating TEXAREA content Hi all, I wonder if I could get your opinion on whether or not something is possible and if it is, is there a really compact way of doing it with jquery? I would like to make a character counter for a textarea input. I would like the string that is the number of chars typed in the box to always be the last chars of the textrarea. A bit like this: I [1 char] I can [5 char] I can type [10 char] you get the idea, the little "[x char]" string floats along as if the insertion point was just before it. Is this going to be possible? All the best, Dug -- Dug Falby http://www.donkeyontheedge.com/
-- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ