Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Client Scripting
Expertise: Beginner
Aug 10, 1998

Inserting Text at Cursor Position

Question:
How can I insert text in a textarea at the current cursor position ? I am able to insert it at the end, for example: textarea.value = textarea.value + "blah blah". But I would like to insert it at the current cursor position.

Answer:
Unfortunately, the functionality you describe is all you have to work with. You can add text before or after the current contents of the TEXTAREA element, but because there is no way to determine the current cursor position within the control you can't add text at the user's current cursor position.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date