/ Published in: jQuery
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>
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>