MouseEvent buttons Property
Which mouse button(s) was pressed?
buttons property returns which mouse buttons are pressed when a mouse event occurs.
buttons property is mostly used with the
buttons property is read-only.
The mouse buttons that were pressed when the mouse event occured. If more than one button is pressed, the values are added.
1 : Left mouse button
2 : Right mouse button
4 : Wheel or middle button
8 : Fourth button (Browser Back)
16 : Fifth button (Browser Forward)
For a left-hand configured mouse, the values are reversed.
|DOM Version:||DOM Level 3 Events|
event.buttons is a DOM Level 3 (2004) feature.
It is fully supported in all modern browsers: