mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 05:55:48 +01:00
move cursor to end in share input
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user