Page 1 of 1

JavaScript: Getting the focus at the END of a textarea?

Posted: Tue Mar 11, 2003 9:13 am
by MattSharp
phpBB can do this, so I know it's possible. How do you get the the cursor to go to the end of a textarea not the beginning? Thanks.

Posted: Wed Mar 12, 2003 12:20 am
by patrikG
I always thought that that is automatic. If not, try:

document.myForm.myFormField.value=document.myForm.myFormField.value;

It simply pastes the text in the formfield into the formfield, thus overwriting the original text with an exact copy. Then the focus is definitely at the end of the textarea.