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/