How to change the input to uppercase as it is being typed

前端 未结 5 1458
盖世英雄少女心
盖世英雄少女心 2020-12-16 03:08

I am using onkeyup=\"this.value=this.value.toUpperCase();\"to change input text value in uppercase. This is working but my need is to change a single letter in

5条回答
  •  忘掉有多难
    2020-12-16 03:57

    You could check what key was pressed in the onkeyup and only process for keys a-z. Should be pretty easy since the keycodes are numeric and you could just check if the keycode is between the keycode for a (65) and z (90).

提交回复
热议问题