event.type

JavaScript 1.2+, JScript 3.0+ Nav4+, IE 4+ Syntax

							event.type

Description

The type property of the Event object refers to the type of event that occurred. The value assigned to type is a string representing the name of the event. See Table 7.25 for the valid event types supported by each browser.

Example

Listing 7.214 shows how the type property can be used to figure out what type of event is being set. This example checks for a few different events. When an event is detected, a message is displayed in the message box indicating to the user which type of event occurred. This example can be expanded to include many different events.

Listing 7.214 Accessing the type Property
 <html> <head> <title>Using the type property for ...

Get Pure JavaScript 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.