Issue with javascript onkeydown - event.which give characters in upper case only

前端 未结 4 429
北荒
北荒 2021-01-14 04:15

I have written a piece of javascript code to get the key pressed within a text area. I have used the onkeydown event to capture the key pressed and am calling a function whe

4条回答
  •  余生分开走
    2021-01-14 04:22

    From http://www.bloggingdeveloper.com/post/KeyPress-KeyDown-KeyUp-The-Difference-Between-Javascript-Key-Events.aspx

    In order to understand the difference between keydown and keypress, it is useful to understand the difference between a "character" and a "key". A "key" is a physical button on the computer's keyboard while a "character" is a symbol typed by pressing a button. In theory, the keydown and keyup events represent keys being pressed or released, while the keypress event represents a character being typed. The implementation of the theory is not same in all browsers.

提交回复
热议问题