function setCursorAtEnd(sTextboxID) { var oTextbox = document.all.item(sTextboxID); if (oTextbox .createTextRange) { var r = (oTextbox.createTextRange()); r.moveStart('character', (oTextbox.value.length)); r.collapse(); r.select(); }}
Subscribe to:
Post Comments (Atom)
8 comments:
very useful.. any chance you know how to do this for Gecko-based browsers?
yeahhhh. that's it. thank you dudeeeeeee.
Thank you.
a cheap way to do this (works on ie7, not tried others yet) :
myEl.focus();
myEl.value = myEl.value;
great post. the line following function call is not really necessary though.
r.collapse();
as the the r.select(); function call puts the focus at the end of the textrange.
what attribute do you use in the textarea tag.
cousin_itt, your cheap way to move the cursor to the end also works fine on Firefox. Thanks
how to do this in Firefox?
createTextRange is for IE
Post a Comment