Knowing the jQuery Caret plugin, I'm still seeing no way to do the following on a single line text box in HTML (i.e. the input:type=text
control) with JavaScript:
I know how to do 1. and 2., just for 3. I have found no way of doing it.
To illustrate it:
My question is:
Is there any way to reliable put the caret at the end of the text and scroll it into the view?
(I can think of simulating pressing the END
key or something like that, but I'm unsure whether this would be the best option).
You could try triggering a right key press after focus.
$('#textbox').focus();
var e = jQuery.Event("keydown");
e.which = 39; // aka right arrow.
$("input").trigger(e);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With