Search⌘ K
AI Features

Going Global: Global Events

Explore global events in HTML5 and JavaScript to enhance interactivity. Learn how to use event attributes like onclick and onload, handle keyboard and mouse events, manage form and media events, and dynamically respond to user actions and document states.

You already used a few events in exercises, such as the onload event when you set the onload attribute of the <body> tag, or the onclick event when you set the onclick attribute of a <button> element.

HTML5 defines dozens of events that are triggered either as a result of user interactions, or as a result of state changes in the document’s lifecycle. You can attach event handler scripts to HTML elements. These handlers are fired when the specific event ...