HTML custom event

Is there an event for situations when something is selected on an HTML page, for example, arbitrary text inside an element span? Is there such a thing, or is regular-interval survey and analysis required window.getSelection()?

I would like to capture this type of event from a browser extension (Chrome).

+3
source share
2 answers

The New York Times implements some optional functions in all of its articles without monitoring for a specific onselection event. An example here , select some text and you will see "?" you can use to search.

. onmouseup , ( ) .

onselect textarea.

+1

jQuery select() select. . http://api.jquery.com/select/

0

Source: https://habr.com/ru/post/1746046/


All Articles