Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vanilla-caret-js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilla-caret-js

Set and get Caret position (contenteditable or TextArea) using Vanilla JavaScript

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
increased by38.63%
Maintainers
1
Weekly downloads
 
Created
Source

Set and get Caret position (contenteditable or TextArea) using Vanilla JavaScript

NPM version NPM size Build Status Donate MIT License

Demo

Demo

Setup

$ npm i vanilla-caret-js
const VanillaCaret = require('vanilla-caret-js');

OR

<script src="https://cdn.jsdelivr.net/npm/vanilla-caret-js@1.0.1/dist/VanillaCaret.min.js"></script>

Example Usage

var caret = new VanillaCaret(document.getElementById('root')); // Initialize
caret.setPos(4); // Set
document.getElementById('currentPosition').value = caret.getPos(); // Get

Development

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 # or also `$ npm run default`

Convert the ES6 code into valid ES5 combining all the modules into one single file

$ node make build # or also `$ npm run build`

Start a nodejs static server

$ node make serve # or also `$ npm run serve`

Keywords

FAQs

Package last updated on 14 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc