开发者

Javascript Manual Selection doesn't replace

开发者 https://www.devze.com 2023-04-13 06:12 出处:网络
I have some text in a textbox. I automatically select some of it by calling textbox.setSelectionRange(a,开发者_如何学Go b). But then, when I start typing again, the letters are appended on the right o

I have some text in a textbox. I automatically select some of it by calling textbox.setSelectionRange(a,开发者_如何学Go b). But then, when I start typing again, the letters are appended on the right of the selection instead of replacing the selected text. Is there any way I can make the selection 'replaceable' by the user?

edit: it seems that if you execute the function twice on the same piece of text, the text doesn't replace any more. So that's what happened

0

精彩评论

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