开发者

Javascript, avoid cursor moving at textbox end

开发者 https://www.devze.com 2023-02-26 03:07 出处:网络
I have a js funciton executed at one textbox OnKeyUp event. The textbox has a valu开发者_如何学Ce by default.

I have a js funciton executed at one textbox OnKeyUp event.

The textbox has a valu开发者_如何学Ce by default.

If I place my cursor in the middle of the string and I add a char, the cursor moves at the end of the string.

I know that this is because the executed function recalculate and set the textbox value.

Is there a way to avoid the cursor moving at the end of the string?

Thanks


Changing the value of the text in the textbox will always move the cursor to the end

0

精彩评论

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