[whatwg] Standard method to get/set caret position

On Sun, 29 Aug 2004 16:44:56 +0000 (UTC), Ian Hickson <ian at hixie.ch> wrote:
> On Thu, 26 Aug 2004, Ted Mielczarek wrote:
> >
> > While working on a javscript tool, I needed a way to get and set the
> > caret position in a textbox.
> 
> Interesting. Just out of curiosity, what is it that you were doing that
> required access to the caret position? If I may ask.

I took Jesse Ruderman's Javascript shell and added tab-completion of
variable names/properties/functions.  For the curious, you can view
the result at: http://ted.mielczarek.org/code/mozilla/shell.html .  My
caret-finding code probably breaks if you actually select some text in
the input box, but it's the best I could do.  Some sort of property
defined on text input elements like .caretPosition would make that a
lot easier.

Received on Sunday, 29 August 2004 20:44:38 UTC