put cursor at end of text input's value

后端 未结 5 2046
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 07:37

So, currently I have a text-input-field with a value that is also autofocused.

On page load, the value is selected / highlighted. Is there a way I can put the cursor at

5条回答
  •  -上瘾入骨i
    2021-02-02 08:05

    Upgrade to @harsha's answer

    I found that to make solution work with Firefox, we need temporary reset value to "not-equal of value", then set it back

提交回复
热议问题