toggle-selection

1.0.6 • Public • Published

Toggle Selection

Simple module exposing function that deselects current browser selection and returns function that restores selection.

var deselect = require('toggle-selection');
var reselect = deselect(); // remove all selection
// … 
// do something with current selection, text, etc;
// …
reselect(); // restore selection

All credits go to @shvaikalesh.

Example

example recording

Package Sidebar

Install

npm i toggle-selection

Weekly Downloads

4,126,869

Version

1.0.6

License

MIT

Last publish

Collaborators

  • sudodoki