button
Summary
Gets the mouse button that caused an event.
Property of dom/MouseEventdom/MouseEvent
Syntax
Note: This property is read-only.
var button = event.button;
Return Value
Returns an object of type NumberNumber
One of the following values -
- 0 - The primary button (usually the left mouse button).
- 1 - The auxiliary button (usually the middle/wheel mouse button).
- 2 - The secondary button (usually the right mouse button).
Any value higher than 2 represents other less common buttons.
Related specifications
- DOM Level 3 Events
- Working Draft
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]