wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes How to get or set the caret position in text (JavaScript) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to get or set the caret position in text (JavaScript)" Watch "How to get or set the caret position in text (JavaScript)" New topic
Author

How to get or set the caret position in text (JavaScript)

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
In an input (text) or text area, is there a way to get or set the position of the caret? (I've always called it a cursor, but java API calls it a caret. Maybe 'cursor' sounds like something evil.) In java there are methods for it, but I can't seem to find anything in JavaScript.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to get or set the caret position in text (JavaScript)