Event Types
An event can be trigger by many differ means. How this event is trigger it referred to as an event type. The following are an overview of the more common event types. For a more complete list, review to the Event Reference.
Mouse Events
Mouse events occur when the user uses the mouse to interact with the page. While there are many different Mouse Events, the most common used are click
, mouseover
, and mouseout
.
Keyboard Events
Keyboard events occur when the user uses the keyboard to interact with the page. There are only three keyboard events: keydown
, keydown
, and keypress
(ignores modifier keys). When a key is pressed the browser will provide a key code that can be used to identify which key was pressed. These codes are retrieved using a property from the Event object. Unfortunately, this part of the API is in the middle of a transition period, so there are two common properties that can be used to retrieve the key code.
The old property is keyCode
, which will provide a number of the represents the key pressed. This number will be different depending on the which the keyboard event.
The new property is key
, which provide a string that represents the key pressed.
Other Standard Events
While the most common events types are going to come from the the mouse or keyboard, there are many other Standard Events that can be used.
The change
event is fired for <input>
, <select>
, and <textarea>
elements when a change to the element's value is committed by the user.