For those keys, event.key is approximately the same as de: Key What if a key does not give any character? For instance, Shift or F1 or others. The check like de="keyZ" won’t work: the first letter of "Key" must be uppercase. Please evade mistypes: it’s KeyZ, not keyZ. Seems obvious, but people still make mistakes. That will become the value of event.key, while de is always the same: "KeyZ". If a user works with different languages, then switching to another language would make a totally different character instead of "Z". The event.key is exactly the character, and it will be different. That gives us two different characters: lowercase z and uppercase Z. The key property of the event object allows to get the character, while the code property of the event object allows to get the “physical key code”.įor instance, the same key Z can be pressed with or without Shift. The keydown events happens when a key is pressed down, and then keyup – when it’s released. Focus on the input field and press a key.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |