instantsetsuna instantsetsuna - 9 months ago 133
Javascript Question

onKeyPress Vs. onKeyUp and onKeyDown

What is the difference between these three events? Upon googling I found that


The KeyDown event is triggered when
the user presses a Key.

The KeyUp event is triggered when the
user releases a Key.

The KeyPress event is triggered when
the user presses & releases a Key.
(onKeyDown followed by onKeyUp)


I understand the first two, but isn't KeyPress the same as KeyUp? (or is it possible to release a key(KeyUp) without pressing(KeyDown) it?)

This is a bit confusing, can someone clear this up for me?

dcp dcp
Answer Source

Check here for the archived link originally used in this answer.

From that link:

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download