Get started with Caret.js CDN
MIT licensed
Caret.js: Lightweight library for manipulating caret position in textareas/inputs.
Tags:- jquery
- caret
- offset
- position
Stable version
Copied!
How to start using Caret.js CDN
$(document).ready(function() {
$('textarea#example').caret();
$('button#append').click(function() {
var textarea = $('textarea#example');
textarea.val(textarea.val() + ' New text appended.');
textarea.caret(); // Move caret to the end of the text
});
});
Copied!
Copied!