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?
Update: To be more clear, text fragment can be part of a sentence or a word or a phrase or whole a paragraph.