jQuery Mouse Events

Beginner
⏱️ Hub guide
📚 Updated: Jul 2026
🚀 22 event tutorials

What You’ll Learn

Mouse events let JavaScript respond when users click, hover, or move the pointer. jQuery’s .on() and .off() provide a consistent API across browsers. Start with the click event — the most common interaction in web UIs.

01

.on()

Bind handlers

02

click

Press + release

03

.trigger()

Fire events

04

Delegate

Dynamic lists

05

.off()

Unbind

06

22 guides

Full index

Introduction

Every interactive web page relies on events — something happens in the browser, and your code responds. Mouse events cover pointer actions: clicking buttons, toggling panels, closing modals, and selecting list items. jQuery wraps the browser’s native event system so you write one handler that works everywhere.

What Are jQuery Mouse Events?

Mouse events are named strings passed to .on()"click", "dblclick", "mouseenter", and others. The handler receives an event object with details about the interaction. Unlike deprecated shortcuts like .click(fn), .on("click", fn) is the modern, flexible approach that also supports delegation and namespaced unbinding.

💡
Beginner Tip

Use .on("click", handler) to bind click handlers — the modern replacement for deprecated .click(handler). Use .trigger("click") to fire handlers programmatically.

📝 Syntax

Minimal click binding workflow:

jQuery
$("#btn").on("click", function() {
  alert("Clicked!");
});
$("#target").trigger("click");
$("#list").on("click", "li", function() {
  $(this).toggleClass("done");
});

👀 click vs mousedown vs deprecated .click()

Three ways to react to pointer input — pick the right tool:

.on("click", fn) → modern bind — full press-and-release inside element .trigger("click") → programmatically fire bound handlers .on("mousedown", fn) → fires on press only — drag, not full click .click(fn) → deprecated shorthand — use .on("click") instead

Mouse Event Tutorial Index

Search by event name or browse by category. Each tutorial includes syntax, try-it examples, and FAQs.

Mouse Events

22 tutorials

Respond to pointer interactions — click, double-click, hover, and movement.

EventDescriptionTutorial
click eventBind a handler or trigger the click event when the mouse button is pressed and released over an element.Open
.click()Deprecated shorthand to bind or trigger click — use .on('click') and .trigger('click') in new code (since 3.3).Open
.toggle() click handlersRemoved legacy API to bind alternating click handlers with .toggle(fn1, fn2) — removed in 1.9; use .on('click') with a counter or .toggleClass().Open
dblclick eventBind a handler or trigger the dblclick event when the user double-clicks an element.Open
.dblclick()Deprecated shorthand to bind or trigger dblclick — use .on('dblclick') and .trigger('dblclick') in new code (since 3.3).Open
contextmenu eventBind a handler when the user right-clicks an element — before the browser menu appears — or trigger it with .trigger('contextmenu').Open
.contextmenu()Deprecated shorthand to bind or trigger contextmenu — use .on('contextmenu') and .trigger('contextmenu') in new code (since 3.3).Open
.hover()Deprecated shorthand to bind mouseenter and mouseleave — use .on('mouseenter') and .on('mouseleave') in new code (since 3.3).Open
mousedown eventBind a handler or trigger the mousedown event when the user presses a mouse button over an element.Open
.mousedown()Deprecated shorthand to bind or trigger mousedown — use .on('mousedown') and .trigger('mousedown') in new code (since 3.3).Open
mouseup eventBind a handler or trigger the mouseup event when the user releases a mouse button over an element.Open
.mouseup()Deprecated shorthand to bind or trigger mouseup — use .on('mouseup') and .trigger('mouseup') in new code (since 3.3).Open
mouseenter eventBind a handler or trigger the mouseenter event when the pointer enters an element — without re-firing on child crossings.Open
.mouseenter()Deprecated shorthand to bind or trigger mouseenter — use .on('mouseenter') and .trigger('mouseenter') in new code (since 3.3).Open
mouseleave eventBind a handler or trigger the mouseleave event when the pointer leaves an element — without firing on child crossings.Open
.mouseleave()Deprecated shorthand to bind or trigger mouseleave — use .on('mouseleave') and .trigger('mouseleave') in new code (since 3.3).Open
mousemove eventBind a handler or trigger the mousemove event when the pointer moves inside an element — read event.pageX and event.pageY for coordinates.Open
.mousemove()Deprecated shorthand to bind or trigger mousemove — use .on('mousemove') and .trigger('mousemove') in new code (since 3.3).Open
mouseout eventBind a handler or trigger the mouseout event when the pointer leaves an element — bubbles on child crossings; filter with event.relatedTarget or prefer mouseleave.Open
.mouseout()Deprecated shorthand to bind or trigger mouseout — use .on('mouseout') and .trigger('mouseout') in new code (since 3.3).Open
mouseover eventBind a handler or trigger the mouseover event when the pointer enters an element — bubbles on child crossings; filter with event.relatedTarget or prefer mouseenter.Open
.mouseover()Deprecated shorthand to bind or trigger mouseover — use .on('mouseover') and .trigger('mouseover') in new code (since 3.3).Open

Conclusion

jQuery mouse events turn pointer interactions into JavaScript callbacks. Start with .on("click", handler) for buttons and interactive elements, use .trigger("click") to fire handlers programmatically, and reach for delegation when lists grow dynamically.

❓ Frequently Asked Questions

Mouse events respond to pointer interactions — click when the button is pressed and released, dblclick for double-clicks, mouseenter and mouseleave for hover, and mousemove for tracking position. jQuery normalizes event binding across browsers through .on() and .off().
Use .on('click', function(event) { ... }) since jQuery 1.7. The old .click(handler) shorthand is deprecated. For dynamic content, use delegation: $('#parent').on('click', 'child-selector', fn).
click fires only after mousedown and mouseup both occur inside the same element. mousedown fires immediately when the button is pressed — useful for drag starts. For typical button actions, click is the right choice.
Call $('#element').trigger('click') to run bound handlers and default actions. Use .triggerHandler('click') if you only want handlers without default behavior like following a link.
Yes. Buttons, links, divs, paragraphs, list items, and spans can all bind click handlers. Non-interactive elements become clickable when you add a handler and optionally set cursor: pointer in CSS.
Read the overview, study the click vs mousedown comparison, browse the event index, then open the click event tutorial for full syntax, five try-it labs, and event-specific FAQs.

Start with click event

Learn .on("click"), .trigger("click"), and event delegation.

click event tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful