Using Event Objects

The browser creates event objects when it detects that an event has occurred. If jQuery defined the event handler, the event object is converted to a jQuery event object that has a few more attributes and methods. Therefore, you need to be aware of which event object type you are working with.

Event objects provide additional information about the event, such as what type the event was (such as a click or a keypress), which key(s) were pressed, what position the mouse was in, what HTML element the event occurred on, and so on. Table 6.2 describes the most commonly used event attributes that you will be working with.

Image

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.