Click to See Complete Forum and Search --> : focus on textarea


grausp
03-09-2003, 05:53 AM
On a website I have a form containing a TEXTAREA and also some buttons that add text to this TEXTAREA, after clicking one of the buttons I want to have the focus returned to the TEXTAREA, that's easy using the focus() function. The problem is that I want the cursor at the end of the text already enterd in the TEXTAREA and not at the start. That's what the focus() does. Any suggestions?

khalidali63
03-09-2003, 07:15 AM
This question has been asnwered several times,just search the forum( dave has a solution on his website)

Cheers

Khalid

Dan Drillich
03-09-2003, 07:21 AM
Please try -


<form name="f">
<input type=textarea name=test size=12>
<br>
<input type=text name=test2 size=12 onkeyup="document.f.test.focus(); document.f.test.value = document.f.test.value">
</form>

grausp
03-09-2003, 12:57 PM
Okay, thanks. I'll give each of the solutions a try.