Chapter 5. Handling Events with JavaScript

After completing this chapter, you will be able to

  • Recognize common JavaScript events

  • Understand how to handle events with JavaScript and jQuery

  • Validate data entered into a web form

EVENTS ARE THINGS YOU REACT TO (or sometimes ignore intentionally). Consider what happens when the temperature in your house or dwelling falls below a certain value—for example, 69 degrees Fahrenheit in my house. The event occurs when the temperature falls below 69; the handling of that event is done by a thermostat. The thermostat reacts or handles the event by starting the furnace. When the temperature falls from 71 to 70, the thermostat doesn’t care; it ignores such events.

For webpages, events include such things as mouse ...

Get Microsoft® Start Here!™ Learn JavaScript 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.