This is the best I can come up with. I wanted to catch the onselect
event, but for some reason Safari won't respond. (Didn't want to keep
using a timeout. It's a hack, but it works.) I reduced the length of
the timeout to 0 milliseconds, and I cleaned up the call by passing
the this object as a parameter. I also changed the moveStart for IE to
a collapse instead.

$(function() {
 $(':text').focus(function() {
  if (this.setSelectionRange) /* DOM */
  {
   setTimeout(function(t) { /* hack for select delay */
    t.setSelectionRange(t.value.length,t.value.length);
   },0,this);
  }
  else if (this.createTextRange) /* IE */
  {
   r=this.createTextRange();
   r.collapse(false);
   r.select();
  }
 });
});

Reply via email to