What is replacing Javascript keyCode?
how are we writing the following, to see if a letter of the alphabet is being pressed, now keyCode is deprecated?
4 Replies
e.key ?
ah i see.. you need a range
i guess e.key + regep :/
MDN Web Docs
KeyboardEvent: key property - Web APIs | MDN
The KeyboardEvent interface's key read-only property returns the value of the key pressed by the user, taking into consideration the state of modifier keys such as Shift as well as the keyboard locale and layout.
MDN Web Docs
KeyboardEvent: code property - Web APIs | MDN
The KeyboardEvent.code property represents a physical key on the keyboard (as opposed to the character generated by pressing the key). In other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys.
Thank you guys