[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

<textarea> insertion point cursor positioning

Posted on 2004-10-22
4
Medium Priority
?
1,088 Views
Last Modified: 2008-03-17
I use the following Javascript to place the insertion point cursor in a <textarea> when the page loads: self.document.myPage.myTextarea.focus(); This puts it at the first character in the <textarea>. Is thre a way to place it after the last character in the <textarea> when there is default text there and the user is to add to it?

0
Comment
Question by:vogtster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:cLFlaVA
ID: 12382580
Yup.

document.forms['myPage'].elements['myTextarea'].focus;
document.forms['myPage'].elements['myTextarea'].value += '';
0
 
LVL 13

Accepted Solution

by:
cLFlaVA earned 2000 total points
ID: 12382584
Whoa,

document.forms['myPage'].elements['myTextarea'].focus();
document.forms['myPage'].elements['myTextarea'].value += '';
0
 
LVL 3

Expert Comment

by:k-do
ID: 12382784
You can modify your onload statement to the following:

self.document.form1.myTextarea.focus();self.document.myPage.myTextarea.value += '';

(Those are two single quotes at the end.)

Hope this helps,

Keith
0
 
LVL 3

Expert Comment

by:k-do
ID: 12382799
Sorry - should've refreshed the page before I posted!  (and the form1 would've been myPage)

Keith
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question