Skip to content
This repository has been archived by the owner on Oct 14, 2018. It is now read-only.
/ caret Public archive

A jQuery plugin for getting and setting the caret position

Notifications You must be signed in to change notification settings

LandonSchropp/caret

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Caret

Caret is a small jQuery plugin that gets and sets the caret position for an HTML element, in characters.
For an (x, y) position, see jquery-caret-position-getter.

Caret may be used as follows:

// get the caret position
var caretPosition = $("textarea").caret();

// set the caret position
$("textarea").caret(newPosition);

Caret follows the jQuery convention of returning the this object for the setter so calls can be chained:

// move the caret and set the color to blue
$("textarea").caret(newPosition).css("color: blue;");

Caret has been tested in Chrome, Firefox, Safari and Internet Explorer 8 and 9.

About

A jQuery plugin for getting and setting the caret position

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published