Difference keyup event, keydown events and input events

  keydown, keyup Belongs to the keyboard events, input it belongs to the text event

Detailed description:

  1. keydown: When the user presses any key on the keyboard trigger, if pressed, will trigger this event is repeated.
  2. keyup: Fires when the user releases a key on the keyboard.
  3. input: Triggered when the element content is changed, these elements refer to  <input>, <select>, <textarea> and specify  contenteditable element attributes.

For example:

  When we enter in a text box, in turn triggers the following events: keydown Events ->  input Events ->  keyup Events.

Guess you like

Origin www.cnblogs.com/belongs-to-qinghua/p/11353091.html