Possible Duplicate:
Use JavaScript to place cursor at end of text in text input element
I have an input field which only takes numbers. Can any one please let me know how to place the cursor only at the end of this text box when clicked on the field.
This is for an mobile optimized site and hence when user clicks on this input form, the cursor should be placed only at the end and the user can delete the number with a back arrow on their phone.
Thanks in advance!
You can try an onclick or onfocus event, which reads the value of the field, then writes it back. When adjusting the text in an active text field, the cursor jumps at the end.
You can try it here: http://jsfiddle.net/inti/uYzVP/