posted 19 years ago
Is there a way to obtain the position of the cursor in an input field? Conversely, is there a way precisely position the cursor in an input field?
I am writing a mask function for an input field and it occurred to me that the user may want to use the arrow keys to go back and insert a missing character in the input field.
It is easy enough to trap arrow keys and allow the user to insert a new character but when he does and the input field value is reformatted, the cursor goes to the end of the field, i.e. after the last character.
What I would like to do is put the cursor back to its previous position so that the user may enter multiple characters at the insert point.
Any suggestions would be appreciated.