I want to know when a mouse button is pressed on the button
, which was the pressed, if the left, right, or middle. The problem is that for the right click I get the typical menu. Nor does it detect if I press the middle one. How to detect also if one was pressed apart from the left one ?, and how to hide the menu that comes out by default when pressing right click?
function handleOnClick(e) {
console.log("button clicked");
console.log(e.button);
}
<button onclick="handleOnClick(event)">
myButton
</button>