469,289 Members | 2,330 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

Set cursor position to the end of a text field ?

Hi,
I can set focus on a text field. But the cursor is always stay at the
beginning , how to set the cursor at the end ?

Thank you.

Aug 10 '05 #1
2 27108
Who
"duzuike" wrote
I can set focus on a text field. But the cursor is always stay at
the beginning , how to set the cursor at the end ?

Thank you.


In some browsers, including IE and FF, the trick is to set the value of the
element after setting the cursor. The cursor will then be moved with it as
the new value is written and end up at the end...

tt.focus(); tt.value = tt.value;

Otherwise, you will need to manipulate text selection ranges, which is a
pain to do crossbrowser.
hth
ivo
http://4umi.com/
Aug 10 '05 #2
Thank you for your valuable reply. It works.

Aug 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by supportgeek | last post: by
1 post views Thread by Tantra Veda | last post: by
1 post views Thread by Paul | last post: by
1 post views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.