Tutorial Move Cursor to End of Input

Where el is a reference to an input or textarea. function moveCursorToEnd(el) { if (typeof el.selectionStart == "number") { ...

Where el is a reference to an input or textarea.
function moveCursorToEnd(el) {
if (typeof el.selectionStart == "number") {
el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
el.focus();
var range = el.createTextRange();
range.collapse(false);
range.select();
}
}

Hot in Week

Popular

Archive

item