MouseEvent buttons Property
Find out which mouse button(s) that was pressed when a mouse event was triggered:
Definition and Usage
The buttons property returns a number that indicates which mouse button or mouse buttons were pressed when a mouse event was triggered.
This property is mostly used together with the onmousedown event.
Tip: Due to lack of browser support, you may want to look at the button property instead.
Note: This property is read-only.
The numbers in the table specify the first browser version that fully supports the property.
A Number, representing one or more mouse buttons that were pressed when the mouse event occured. If more than one button is pressed, the values are combined to produce a new number (For example, if the left button (1) and the right button (2) are pressed, the returned value is 1+2, which is 3).
|DOM Version:||DOM Level 3 Events|
HTML DOM reference: MouseEvent button Property
HTML DOM reference: MouseEvent which Property
❮ Event Object