MouseEvent button Property in JavaScript
MouseEvent button Property in JavaScript
The button property is a read-only property and it is used to return a number that indicates which mouse button was pressed when a mouse event was triggered. It is used in combination with onmousedown event. Its possible values are:-
- 0 => Left mouse button
- 1 => Wheel/middle button
- 2 => Right mouse button
Syntax:-
Its syntax is:- event.button
Return:-
Its return is:- number denoting which mouse button is pressed when the mouse event occurred