Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

yields/on-select

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

on-select

Invoke a callback when the user selects text in the page using the mouse or the keyboard.

Installation

Install with component(1):

$ component install yields/on-select

Example

var onselect = require('on-select');
var unbind = onselect(el, selected);

function selected(e){
  console.log(e);
  unbind();
}

API

onselect(el, fn)

Invoke fn(e, str) when a user selects within el.

str is the user selected text.

License

MIT

About

Invoke a callback when a user selects some text.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •