I would like to know when a user selects text in an html page using Javascript. The text should not be editable. The onselect
event seems to be only applicabl
You could capture the mouseUp
event, and check if some text is selected using window.getSelection()
.
This method may however not be cross-browser compatible (the window.getSelection()
).
EDIT: here is a pretty complete example with mouseUp
binding : http://mark.koli.ch/2009/09/use-javascript-and-jquery-to-get-user-selected-text.html