Detect what is selected (highlighted) or clicked within an element on a page?

Posted by Fog Cook on Stack Overflow See other posts from Stack Overflow or by Fog Cook
Published on 2012-09-13T09:33:18Z Indexed on 2012/09/13 9:38 UTC
Read the original article Hit count: 185

Filed under:
|
|
|
|

How would one go about detecting what has been selected on a page in a browser? Example: Click, hold, select 3 words and 1 image on a page, release.

Sub-question: How to detect what letter someone clicked on?

Without using: A span injector breaking everything up OR a WYSIWYG plugin

I'm hoping this isn't just a type of browser interaction you can't detect.

There could be many uses, but my goal is a simple 'live' page editor, or at least a way to know what someone is clicking on/selecting aside from just the id of an element.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html5