By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,702 Members | 1,771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,702 IT Pros & Developers. It's quick & easy.

bring back cursor to editing position while editing the textarea in javasript

P: 1
Expand|Select|Wrap|Line Numbers
  2. function textCounter(field, countfield, maxlimit) {
  3.     if (field.value.length > maxlimit){ 
  4.           field.value = field.value.substring(0, maxlimit);
  5.     }
  6.     else { 
  7.           countfield = Number(maxlimit) - Number(field.value.length);
  8.     }
  9. }

I am using textarea that has limit of 50 characters. After i enter 50 characters,i put cursor in the middle of the text to edit the text entered.
The problem is When i enter one character, it takes that character and go at the end to delete the last character, it deletes it but stays there and doesnot come back to editing position.I want the cursor to remain at that position only and deletion to take place automatically from the end.

Please help with an answer asap. Thanks in advance.:)
Aug 3 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.