Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert text on cursor in a textarea 1

Status
Not open for further replies.

lumberjakel

Programmer
Oct 27, 2001
29
NL
Insert text on cursor in a textarea

This is what i want:
I have one textarea, an textfield (<input type=text>)
and a button (non-submit).
when the button is pushed, the text in the textfield must be inserted into the textarea. But not at the and, but at the cursor position. It wouldn't be difficult to place the text at the end:
Code:
function ins_text()
{
  textarea1.value+=textfield1.value;
}

But I want it to be inserted on cursor position. So I have to find out the cursor position in my textarea, and that is where the problem is...

Please help me out...
 
here is what we have here:
thread216-169712 Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top