Selected text event trigger in Javascript
<p>It may sound a newbie question but I wanted to know how I can trigger a custom JavaScript function when someone selects a given text fragment  on a page using mouse. Also is there any way to find the position of selected text on the webpage?</p>

<p>Update:
To be more clear, text fragment  can be part of a sentence or a word or a phrase or whole a paragraph.</p>
