Set and get Caret position (contenteditable or TextArea) using Vanilla JavaScript
Example
var caret = new VanillaCaret(document.getElementById('root'));
caret.setPos(4);
document.getElementById('currentPosition').value = caret.getPos();
Usage
Once you've downloaded the files in this repo please run the following command in your terminal from the project folder (it may require sudo
):
$ npm install
Available tasks
Build and test
$ node make
Convert the ES6 code into valid ES5 combining all the modules into one single file
$ node make build
Start a nodejs static server
$ node make serve