Is there any way to trigger the focus() event on a <textarea> element and put the mouse cursor at the end of the text which is inside the textarea?
thx
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Was going to close as duplicate, but the other one doesn’t cover how to trigger the focus.
See: Use JavaScript to place cursor at end of text in text input element for how to put the mouse cursor at the end
And to trigger the focus, you just need
$('#foo').focus()or$('#foo').trigger('focus')