textarea with character counter + another counter.

mike55

Contributor
Joined
Mar 26, 2004
Messages
727
Location
Ireland
I am writing a application that sends SMS messages, the maximum number of characters that I can send is 612. I have two textboxes, charsLeft and messageNumber, into which I place the number of characters remaining, and the number of actual SMS messages that the users messages will be divided into.

I am using javascript to carry out my calculations using the onKeyUp event of the textarea, this means that the calculations are carried out everytime the user presses a key.

A problem arises if the user spots an error in their message and attempts to correct it. When they start typing in the middle of the message text, the first character will be displayed at the correct location, but the next character will be displayed at the end of the text in the textarea as the cursor hops to the very end after the text is typed.

Does anyone know of any control/technique that can allow me to stop this from happening.

Mike55.
 
Why would the cursor jump to the end? The only thing I can take think is that when you populate the textboxes, focus is given to that textbox and then back to the textarea when the user starts typing. Instead of textboxes try using spans or divs to show the info.
 
Back
Top