View Full Version : focusing on text input field

12-23-2007, 11:39 PM
How can I place the text cursor in a certain position among text in a <input type="text" /> form field?

for example let's say the input field contains this value:

I want to place the blinking cursor before the 'h'
I want to place the linking cursor after the 'o'

How JS code do I need to do this?
I tried focus() but this just places the focus on the form field, and does not change cursor position.


Philip M
12-24-2007, 08:47 AM
I am afraid that I do not understand the question. What is it which will cause the cursor to be placed before the 'h' or after the 'o'? User focusing on the field? If so what logic applies?

Have a look at:-