See http://code.google.com/p/ierange/
For a bit of history (though a different author), you can read http://marijn.haverbeke.nl/codemirror/story.html the last 6 paragraphs under 'Take one: Only indentation'. - Richard On Tue, Aug 18, 2009 at 4:08 PM, Chris Jordan <chris.s.jor...@gmail.com>wrote: > > Is there a particularly jQuery-ish way to determine if there is text > selected on the screen? I've googled around for some code on this > subject, but I want to be sure that whatever I use is cross-browser > compatible. It's been my experience that if I let jQuery do the heavy > lifting for me, that my solutions are always compatible across the > major browsers. > > What I'm specifically needing to do is see if the length of what the > user has selected in a text field is the same as the length of all of > the text in that field. Make sense? In other words, if I've got a text > box with fifteen characters in it, I want to know the length of their > selection (zero to fifteen). > > Thanks!