Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EvandroLG/selecting
:fishing_pole_and_fish: A library that allows you to access the text selected by the user
https://github.com/EvandroLG/selecting
javascript selecting
Last synced: 3 months ago
JSON representation
:fishing_pole_and_fish: A library that allows you to access the text selected by the user
- Host: GitHub
- URL: https://github.com/EvandroLG/selecting
- Owner: EvandroLG
- Created: 2014-12-29T01:00:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-22T18:57:17.000Z (over 9 years ago)
- Last Synced: 2024-11-09T06:51:43.882Z (3 months ago)
- Topics: javascript, selecting
- Language: JavaScript
- Homepage:
- Size: 331 KB
- Stars: 92
- Watchers: 4
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-javascript - selecting - A library that allows you to access the text selected by the user - ★ 69 (String)
README
# selecting
A library that allows you to access the text selected by the user.## Instalation
To install Selecting, execute:```shell
npm install selecting
```Or Bower too:
```shell
bower install selecting
```Or simply pick up the file from src directory.
## Supported Browsers
* Google Chrome
* Firefox
* Internet Explorer 9.0+
* Safari
* Opera
* iOS
* Android## How to use?
Selecting doesn't depend on jQuery, Zepto or any other library to work. You need just to include it at the end of your HTML code:```html
```Then you can call
window.selecting
function passing two parameters: an DOM element (jQuery object or NodeList) to listen to and a callback function that receive a [Selection](https://developer.mozilla.org/en-US/docs/Web/API/Window.getSelection) object by parameter. For example:```js
window.selecting($('.container'), function(selector) {
// Properties
selector.text; // The selected text
selector.wordCount; // The number of words selected
});
```## Example
[See a simple example](http://evandrolg.github.io/selecting).## Contributors
|[](https://github.com/evandrolg)|[](https://github.com/felquis)|[](https://github.com/gibatronic)|
|:---:|:---:|:---:|
|[@evandrolg](http://www.github.com/evandrolg)|[@felquis](http://www.github.com/felquis)|[@gibatronic](http://www.github.com/gibatronic)|