[whatwg] Standard method to get/set caret position

Ian Hickson ian at hixie.ch
Fri Nov 12 02:30:49 PST 2004

On Sun, 29 Aug 2004, Jim Ley wrote:
> 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.
> The typical use case for this, is some sort of rich editor, where a user 
> can use a button to add some sort text content into a text area, so 
> perhaps you'd have a button to add an email address from your address 
> book into an email you're authoring (ie to send to someone else)
> For webapps this would certainly be common requirements, as to what's 
> best to do, I've not thought about it yet...

Yeah, that makes sense. I could imagine an API having something like "wrap 
the selection in this markup" or "insert this markup at the current cursor 
position". I'll look closely at what contentEditable APIs are like here.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list