Input input box, lowercase to uppercase, use keyup, but when the mouse moves in the middle, after entering one, the cursor automatically jumps to the back.

input input box, lowercase to uppercase, use keyup, but when you move the mouse in the middle, after entering one, the cursor automatically jumps to the end

<input name="htmer" type="text" onkeyup="this.value=this.value.toUpperCase()" />

could you tell me how to solve this?

Mar.17,2022

this is because the onkeyup () event is triggered by releasing the button

if you solve the problem, you can change it to onchange ()

.

reference link: onchange event

Menu