View Full Version : Insert text in textarea at position of cursor

01-20-2005, 02:45 AM
I'm clueless on how to do this, as my js knowledge is very limited. I have option/select menus, which trigger off js prompts to ask for text. Once the text is entrered, it goes into a textarea. Now I don't always want the text to go at the start or end of the textarea, but where the cursor is. I currenty have

function headers(type){
var newheader = prompt('Insert '+type,'');
document.form1.content.value += '['+type+']'+newheader+'[/'+type+'] \n';

How can I modify it to insert text where the cursor is? Ta

01-20-2005, 04:27 AM
For what it's worth there is an IE version I once found before for someone on this forum. http://www.codingforums.com/showthread.php?t=49595

01-20-2005, 02:02 PM
Ta, will have a play around with it :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum