jQuery Cursor Functions


/ Published in: jQuery
Save to your folder(s)

Used on ``'s and ``'s
Several jQuery functions for getting the current cursor position and setting the current cursor position. Also allows for selecting text in a certain range.

Usage:
<pre>
$("input[name='username']").getCursorPosition();
$("input[name='username']").setCursorPosition(5);
$("input[name='username']").getSelection();
$("input[name='username']").getSelectionStart();
$("input[name='username']").getSelectionEnd();
$("input[name='username']").setSelection(4, 20);
</pre>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.