lumberjakel
Programmer
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:
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...
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...