Thanks Ariel, (and thanks Jake and Chris too)
Just because so many people have been asking for solutions straight up...
As you may have guessed, I'm not a developer, I'm an IA. The developers are telling me this isn't possible and I figured if it were, the folk on this list would be able to say. So if I understand correctly, by the sound of it, this should be possible:-) You all had concerns about usability and make some very good points. What I am trying to do is make the counter go away altogether. Visually, the characters at the end of the textarea input are very light grey and are almost invisible. The plan is to do this for a few few months then remove it altogether. Here's a gif of the interface in rough form (brackets not to be orange, that was the design guy adding bells and whistles as usual) http://www.donkeyontheedge.com/dev/i/OM2_2_writeSMS-story.gif Chris:
What happens when the user exits that field?
nothing visual, the text remains in the field
What happens when the user goes back into that field?
Nothing special, the field remains an ordinary textarea
If they press the End key where does their cursor go?
countString-1
What happens when the user tries to put their cursor after the "[x char]" string?
The insertion point is displayed where it was put. On keydown it moves to countString-1 Ariel sent me this really useful methodology but unfortunately I didn't get very far...
steps: 1. identify what event to listen to when trying to respond to key typing in a textarea
Presumably onChange? I guess keyup and keydown is too resource hungry?
2. create a jQuery function to select that textarea by id
$("#sms_txt").click(function() { alert("I\'m a textarea:-)"); }); (OK that works)
3. bind on that textarea, to that event type, a function that says 'hi'
$("#sms_txt").bind("keydown",function() { alert("hi"); }); (OK that works except I'm stuck as I can't get it to work with bind("change") )
4. edit that function to alert the current value of the textarea (think 'this') 5. edit that function to alert the length of that value 6. edit that function to append that value and whatever text you want to the current value of the textarea
Thanks all :-) Dug -- Dug Falby http://www.donkeyontheedge.com/