I am confused about the different ways of pressing keys, pressing keys and pressing keys. It seems that I missed an important part of the documentation that explains the subtleties and nuances of this trio. Can someone help me figure out which document I need to read in order to make better use of these events? If you need details, see below.
@ov: you asked me to show some code, but this is not a special problem in the code that I am trying to solve. I am trying to figure out the behavior of these event handlers and ask someone who understands them to show me good documentation.
I use jQuery to create an input form and paste it into my document. It works great, basically. I want the form to respond to the keyboard, like most other input forms that I see there: the esc key should reject the form in the same way as pressing the cancel button, and because the form has <textarea> on it, cmd + enter should match by pressing the OK button. It seems simple enough to use the keypress event. The problem is that Chrome does not call my esc or cmd + enter key handler. It runs for ctrl + enter and option + enter and for alphanumeric characters, but not cmd + enter .
So, I will use keyup instead. I get keyup for esc and keyup for cmd and keyup for enter , great. But I do not get keyup for enter key while I hold cmd .
The third time, enchantment, you might think that the failure works, but with keydown you get the retry keys. I know all you have to do is untie the handler on the first call, but it seems strange that three different types of events will behave differently. Why is this? Is there an obvious document that I obviously have not read?
jquery keyup keypress keydown macos
GreatBigBore Oct 10 '12 at 20:01 2012-10-10 20:01
source share