Chapter 4

Reacting to Events with JavaScript and jQuery


check Exploring web page events

check Using events with JavaScript

check Working with jQuery and events

In the previous chapters in this minibook, I explain how to incorporate both JavaScript and jQuery into your HTML5 code to help create a dynamic web application. The trick to using JavaScript and jQuery, though, is knowing when to use them. How are you supposed to know when your site visitor is hovering the mouse pointer over a product in your catalog to pop up more information? Fortunately, your web page is talking to you, telling you what your website visitors are doing at all times. All you need to do is listen to your web page and direct your JavaScript or jQuery code accordingly. That’s exactly what this chapter shows you how to do.

Understanding Events

The world is full of events. There are birthday events, holiday events, school events, all types of events competing for your time. Your world is loaded with events, and it’s your job to determine which events to participate in (your birthday) and which ones to ignore (Talk Like a Pirate Day?).

The same is true with your web application. There are lots of events that ...

Get PHP, MySQL, & JavaScript All-in-One For Dummies now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.