caret-position2

Manage caret/selection on input/textarea. Refactored caret-position.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
caret-position2
1.0.36 years ago9 years agoMinified + gzip package size for caret-position2 in KB

Readme

caret-position2
Get and set the user's text selection on an input or text area.
$ npm install caret-position2
var get = require('caret-position2/get');
var set = require('caret-position2/set');

// Set caret position after the first character
set(input, 1)
get(input) // -> { start:1, end:1, caret:1 }

// Set text selection to the second and third character
set(input, 1, 3)
get(input) // -> { start:1, end:3, caret:3 }

NPM