Jump to content

Insert at cursor position - alteration to existing script


Canman2005

Recommended Posts

Hi all

 

I have a simple form which has two buttons and a form field, when you click one of the two buttons, it inserts the value of the selected button into the form field.

 

The code is

 

<form>
<input type="text" name="tester">
<input type="button" value="1" onclick="tester.value+='1'">
<input type="button" value="2" onclick="tester.value+='2'">
</form>

 

At the moment, when you click one of the two buttons, it always inserts the value at the end of whatever has already been entered in the text field.

 

I want to change this, so that it inserts the button value into the text field, but at the position of where the text cursor is blinking.

 

Can this be done??

 

Hope that makes sense

 

Any help would be gratefully appreciated.

 

Thanks in advance

 

Thak

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.