caret-position2

1.0.3 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    193
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    193
  • 1.0.2
    2
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i caret-position2

Weekly Downloads

196

Version

1.0.3

License

none

Unpacked Size

5.52 kB

Total Files

6

Last publish

Collaborators

  • dfcreative