Code Editor
Web Browser
Learn
Mouse Events

Review: Event Handlers

In this lesson, you learned a few of the most common mouse events in the jQuery library.

  • Event handlers are comprised of an event listener and a callback function. An event listener specifies the type of event that will be detected. The callback function executes when the event happens. Everything together is the event handler.
  • An event listener is set up using the .on() method.
  • The events listened for included: 'click', 'mouseenter', and 'mouseleave'.
  • In addition to event handlers, you learned how to use event.currentTarget to refer to the individual element that an event occurred on.

Well done! At this point, you understand the purpose of an event, and how to link it to a callback function. Use jqapi.com to learn about some other events that jQuery has to offer. Select Events in the left navigation bar to browse these other events.

Instructions

If you want a challenge, try to add some new events to the Sole Shoes website — use the list event listeners below to help.

Mouse events

  • dblclick
  • mousemove

Though they are not used as frequently, jQuery also supports keyboard events. If you're looking for a challenge, give the following event listeners a try:

Keyboard events

  • keydown
  • keypress
  • keyup
Report a Bug
If you see a bug or any other issue with this page, please report it here.