Learn

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

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?