JSPM

caret-position2

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 218
  • Score
    100M100P100Q80479F

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

Package Exports

  • caret-position2
  • caret-position2/get
  • caret-position2/set

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (caret-position2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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