onKeyPress Vs. onKeyUp and onKeyDown

前端 未结 12 849
醉酒成梦
醉酒成梦 2020-11-22 07:44

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

  • The onKeyDown event is triggered when the user pre
12条回答
  •  再見小時候
    2020-11-22 08:15

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

    From that link:

    In theory, the onKeyDown and onKeyUp events represent keys being pressed or released, while the onKeyPress event represents a character being typed. The implementation of the theory is not same in all browsers.

提交回复
热议问题