MouseEvent button Property
Which mouse button was pressed?
Definition and Usage
button property returns which mouse button is pressed when a mouse event
button property is mostly used with the
button property is read-only.
|Return Value:||A Number.
Which mouse button that was pressed:
0 : Left button
1 : Wheel or middle button (if present)
2 : Right button
For a left-hand configured mouse, the values are reversed.
|DOM Version:||DOM Level 2 Events|
event.button is a DOM Level 2 (2001) feature.
It is fully supported in all browsers: