MouseEvent buttons Property
Description
The buttons
property returns which mouse buttons are pressed when a mouse event occurs.
The buttons
property is mostly used with the
onmousedown
event.
The buttons
property is read-only.
Syntax
event.buttons
Technical Details
Return Value: |
A Number. 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 |
Browser Support
event.buttons
is a DOM Level 3 (2004) feature.
It is fully supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.