`, ``, ``, `
Ev Onmousedown
## HTML onmousedown Event Attribute
The `onmousedown` event attribute fires the moment a user presses a mouse button over an HTML element.
Unlike the `onclick` event, which requires the mouse button to be pressed and released, `onmousedown` triggers immediately when the mouse button is first pushed down. This makes it ideal for creating responsive UI elements like drag-and-drop interfaces, custom buttons, and interactive games.
---
## Browser Support
The `onmousedown` attribute is fully supported by all major modern web browsers:
* Google Chrome
* Microsoft Edge / Internet Explorer
* Mozilla Firefox
* Apple Safari
* Opera
---
## Definition and Usage
The `onmousedown` attribute executes a JavaScript script when a mouse button is pressed down over an element.
### Event Execution Order
The `onmousedown` event is part of a sequence of mouse events. The order of execution depends on which mouse button is clicked:
**For the Left or Middle mouse button:**
1. `onmousedown` (Fires when the button is pressed)
2. `onmouseup` (Fires when the button is released)
3. `onclick` (Fires after the click sequence is completed)
**For the Right mouse button:**
1. `onmousedown` (Fires when the button is pressed)
2. `onmouseup` (Fires when the button is released)
3. `oncontextmenu` (Fires when the context menu is triggered)
### Limitations
The `onmousedown` attribute is a global event attribute, but it **cannot** be used on the following HTML elements:
* ` `, ``, `
`, ``, ``, `
`, ``, ``, `
YouTip