beviz / jquery-caret-position-getter

you can get the cursor caret offset position(i.e.x,y) by this plugin, even included index getter.
http://bevis.me/jquery-caret-position-getter.html
41 stars 15 forks source link

Usage

var pos = $('textarea').getCaretPosition();

// now you can use left, top(they are relative position)

$my_tip.css({
    left: this.offsetLeft + pos.left,
    top: this.offsetTop + pos.top
});