Difference between keyup (), keydown () and keypress () [duplicate]

10

I would like to know the difference between keyup() , keydown() and keypress() , in my opinion I think they do the same thing, but what is the purpose of each?

Performance improvement for each type?

    
asked by anonymous 21.01.2016 / 14:38

1 answer

16

In fact they do not do the same thing.

keyup () : The event occurs when the key returns to its original position on the keyboard (i.e. when you release it).

keydown () : The event occurs when the key is pressed.

keypress () : The event occurs when the key is pressed.

The difference between keypress () and keypress () is that the latter is not captured when the ctrl , alt or shift are pressed.

    
21.01.2016 / 14:43