$ npm i vanilla-caret-js
const VanillaCaret = require('vanilla-caret-js');
OR
<script src="https://cdn.jsdelivr.net/npm/vanilla-caret-js@1.1.0/dist/VanillaCaret.min.js"></script>
var caret = new VanillaCaret(document.getElementById('root')); // Initialize
caret.setPos(4); // Set
document.getElementById('currentPosition').value = caret.getPos(); // Get
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
$ node make # or also `$ npm run default`
$ node make build # or also `$ npm run build`
$ node make serve # or also `$ npm run serve`