JavaScript has several built-in ways of reacting to user interaction and other events. To make a page dynamic and responsive, we need to harness this capability so that we can, at the appropriate times, use the jQuery techniques you learned so far and the other tricks you'll learn later. While we could do this with vanilla JavaScript, jQuery enhances and extends the basic event-handling mechanisms to give them a more elegant syntax while making them more powerful at the same time.
In this chapter, we will cover:
- Executing JavaScript code when the page is ready
- Handling user events, such as mouse clicks and keystrokes
- The flow of events through the document, and how to manipulate that flow
- Simulating events as if the user initiated them