jQuery Mouse Events

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.
.on()
Bind handlers
click
Press + release
.trigger()
Fire events
Delegate
Dynamic lists
.off()
Unbind
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.
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:
$("#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:
Mouse Event Tutorial Index
Search by event name or browse by category. Each tutorial includes syntax, try-it examples, and FAQs.
Mouse Events
22 tutorialsRespond to pointer interactions — click, double-click, hover, and movement.
| Event | Description | Tutorial |
|---|---|---|
click event | Bind 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 handlers | Removed 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 event | Bind 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 event | Bind 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 event | Bind 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 event | Bind 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 event | Bind 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 event | Bind 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 event | Bind 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 event | Bind 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 event | Bind 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
Start with click event
Learn .on("click"), .trigger("click"), and event delegation.
6 people found this page helpful
