Reputation:
When i call TextBoxNameHere.Focus() it sets focus BUT it highlights the contents of the text box
I need it to set the cursor to be at the last character so if someone presses a key after that it doesn't erase the content, I have searched through a great deal of questions, but most of them are just asking how to set focus which i already know =|
Upvotes: 2
Views: 2494
Reputation: 655
Try this:
var value = TextBoxNameHere.val();
TextBoxNameHere.Focus();
TextBoxNameHere.val(value);
As in, reset the value after giving focus
Upvotes: 0
Reputation: 5251
You can usually do something like:
txtbox.Select(txtbox.Text.Length, 0);
Upvotes: 3