Skip to content

Measure the position in pixels of the caret of a text input, relative to the page or to the input. No dependencies.

License

Notifications You must be signed in to change notification settings

Fetchnotes/Caret.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caret.js Measure the position of the caret of a text input, relative to the page or to the input. No dependencies needed.

Demo

You can check out a nifty demo here.

Usage

var textarea = document.getElementById('#myTextarea');

var caret = new Caret(textarea)

textarea.onkeyup = function(event) {
  console.log(caret.position); // Prints out position object {x: int, y: int}
};

About

Measure the position in pixels of the caret of a text input, relative to the page or to the input. No dependencies.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •