Invoke a callback when a user selects some text.
JavaScript Makefile
Switch branches/tags
Pull request Compare This branch is 4 commits ahead, 5 commits behind yields:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
example.html
index.js
package.json

Readme.md

on-select

Invoke a callback on user selection. This is a fork of yields/on-select.

Installation

Install with Duo, Component, or NPM.

$ npm install 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