From the course: Web Programming Foundations

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Events

Events

From the course: Web Programming Foundations

Start my 1-month free trial

Events

- [Instructor] Any time something happens in a browser, an event is triggered, and JavaScript can use these events to trigger further behaviors. Now everything that happens in the browser is registered as an event. Open the browser, that's an event. Enter a URL in the address bar and hit enter, that's an event. Click a link, that's an event. Move your mouse, that's an event. Whenever you interact with the browser in any way, you fire an event and the browser reacts to that event with pre-configured responses. Using JavaScript, we can write our own scripts to respond to these events as well. The formula for binding JavaScript functionality around events is called event handling and typically takes this form. First, identify the DOM node the interactive behavior will be attached to. For example, a call to action button. Second, identify the event you want to detect, like a click or a hover or something else, and bind that event to the DOM node. And third, create a function that is…

Contents