An Introduction to Events

When you write JavaScript in the browser, you’re writing event-driven code. Most of your code will be executed when something happens, such as having content slide in when a user clicks a link. Even though you might not have realized it, you’ve already written some event-based code:

$(function() {});

You’ve been writing code that runs when the document is ready, as I’ve explained. This is an event that you’re attaching code to. It is also known as binding. You have bound some code to run on a certain event. In this chapter, you will look at the type of events, and at the end of the chapter, use your new knowledge ...

Get Beginning jQuery 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.