!! Use event.which instead of event.button.
Specifies the function to run when the mousedown event is triggered. !
For example, consider the HTML: Syntax. Syntax: To act only on specific buttons, we can use the event object's which property. Note: This differs from the click event in that click is fired after a full click action occurs; that is, the mouse button is pressed and released … I've been looking everywhere for this. JavaScript disabled.