Ron - Thursday, February 24, 2011 1:26 PM:
I have some code to define the beginning of part description, basically it reads some filtered list and adds the values to the name field on the form when the user clicks in the field, the problem is that once it applies the base descrption the cursor moves to the beginning of the field. I want the cursor to stay at the end. Standard Java you would simply set the focus then set the value, but this does not work here.
Any ideas?
Thanks
Ron
Brian - Friday, February 25, 2011 6:24 AM:
Hi Ron,
Try this:
var myEl = document.getElementsByName("name");
myEl[0].value = "Default";
var txtBox = myEl[0];
if (txtBox.createTextRange)
{
var r = (txtBox.createTextRange());
r.moveStart('character', (txtBox.value.length));
r.collapse();
r.select();
}
Cheers,
Brian.