Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus to the last character of a textbox

Status
Not open for further replies.

mmarseil

Programmer
Apr 26, 1999
12
US
Does anyone know how to set focus to the last character of a textbox in javascript.  For example when a page loads a value will be set in a textbox. Take the word "sample", for instance.  I want to set focus to the textbox and the cursor should appear after the "e" in "sample".  I've tried to populate that textbox and then set focus, hoping that the cursor would be at the end since there was already text in there, but it just put the cursor at the beginning of the word.  Any help would be greatly appreciated!!
 
Dear mmarseil,<br><br>As far as I know there is no way to accomplish this is the current standard. You are limited to selecting all the text or letting the browser perform default behavior. Hopefully someone will let us know if I am wrong.<br><br>You might be able to accomplish this in IE 5 using the 'behavior' implementation, but I haven't looked into that yet so I can't really say.<br><br>Good Luck<br>-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top