开发者

jquery trigger focus and cursor movement

开发者_开发问答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


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')

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜