Cursor to end of line in textbox

  • Thread starter Thread starter Gyetko
  • Start date Start date
G

Gyetko

I have a textbox on an ASP.NET webform (VB code behind). Is there a
way for me to set the cursor to the end of the line on a gotfocus call?
Right now I'm using the following to set the foucs to that textbox on
a keypress (given certain criteria). Thanks.

document.forms[0].myTextBox.focus()
// document.forms[0].myTextBox.EOL --- would be nice here : )

Or I could use it somewhere here when it actually gets the focus:

Page Load VB:
myTextBox.Attributes.Add("onfocus", "setGotFocus()")

JavaScript:
function setGotFocus()
{
// document.forms[0].myTextBox.EOL --- would be nice here : )
document.forms[0]['myTextBox'].value = myVariable
}
 
try adding a space to the end of the text box and selecting it. Good luck
making it work on all browsers.
 
Back
Top