Skip to content

🎣 A library that allows you to access the text selected by the user

Notifications You must be signed in to change notification settings

EvandroLG/selecting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selecting

A library that allows you to access the text selected by the user.

Instalation

To install Selecting, execute:

  npm install selecting

Or Bower too:

  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:

  <script src="selecting.js"></script>

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 object by parameter. For example:

  window.selecting($('.container'), function(selector) {
    // Properties
    selector.text; // The selected text
    selector.wordCount; // The number of words selected
  });

Example

See a simple example.

Contributors

@evandrolg @felquis @gibatronic
@evandrolg @felquis @gibatronic

About

🎣 A library that allows you to access the text selected by the user

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published