Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Placing Cursor at End of Text

 
Steve Dyke
Ranch Hand
Posts: 1678
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my JSP pages I have input text boxes. When I use the mouse and click into these boxes the cursor does not automatically go to the first position and if text is already in the box the cursor does no go to the end.

Can this be fixed?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the HTML/Javascript forum where client side issues are discussed
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have no control over this really since it is a browser implementation.

You can play with this code:



<input type="text" onfocus="SetCursorToEnd(this)">

Only issue is if comeone clicks on the field manually, it will not allow them to focus where they wanted to go.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Dyke:
Can this be fixed?
It's not broken. That's the expected behavior.
[ August 21, 2007: Message edited by: Bear Bibeault ]
 
Jeff Horan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't a synthetic event fire and set the keycode to 35 (end) or 39 (right) and move a specific num of chars over? I'm trying that now, but I don't know about javascript events to get this to work. This is what I have so far:


Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic