move cursor to end in share input

This commit is contained in:
Baris Soner Usakli
2014-02-12 10:36:17 -05:00
parent b5d31dd889
commit 4c6fb72db0
2 changed files with 18 additions and 1 deletions

View File

@@ -242,6 +242,21 @@
});
};
//http://stackoverflow.com/questions/511088/use-javascript-to-place-cursor-at-end-of-text-in-text-input-element
$.fn.putCursorAtEnd = function() {
return this.each(function() {
$(this).focus();
if (this.setSelectionRange) {
var len = $(this).val().length * 2;
this.setSelectionRange(len, len);
} else {
$(this).val($(this).val());
}
this.scrollTop = 999999;
});
};
})(jQuery);
}