jQuery: get input selection range
<p>Is there any event in jQuery to listen to input selections?</p>

<p>For example, let's say I've written <code>foo_bar</code> in a text input. I then select the word foo with the mouse. So the event should return <code>0, 2</code> (the string position of <code>foo</code>).</p>

<p>Is there any possible way to accomplish this? I don't know where to start, I'm flipping trought jQuery API pages but can't seems to find anything helpfull.</p>

<p>I though about listening to <code>mousedown</code> events on the input, then somehow retrieve the position of the string where the click happened (not sure if it's even possible) and then getting the position where the <code>mouseup</code> happened.</p>

<p>Any info, sources or examples will be welcomed.</p>
