Skip to content

get or set the selction range, or cursor position, for contenteditable

Notifications You must be signed in to change notification settings

TooTallNate/selection-range

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selection-range

Get or set the selection range, or cursor position.

Installation

Install with component(1):

$ component install bmcmahen/selection-range

Usage

position(el, 5, 25); // select range of el from 5 - 25
position(el, 5); // set the cursor at 5
var pos = position(el); // get range of selection
// pos.start = start index
// pos.end = end index
// pos = undefined if no cursor

Tests

npm install component-test
make test

License

MIT

About

get or set the selction range, or cursor position, for contenteditable

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%