This content originally appeared on DEV Community and was authored by 101samovar
We have some site.
Let’s click with the mouse right button.
The default context menu pops up.
We need to add an event listener to the “contextmenu” event.
And we need to prevent the default behaviour of the context menu event.
That’s all.
Let’s click with the mouse right button.
There’s no default context menu.
Only our right button message.
I hope you found this article useful, if you need any help please let me know in the comment section.
? See you next time. Have a nice day!
Subscribe to our channel:
https://www.youtube.com/c/Samovar101
This content originally appeared on DEV Community and was authored by 101samovar
101samovar | Sciencx (2021-09-21T14:12:09+00:00) How to check if the mouse right button has been clicked?. Retrieved from https://www.scien.cx/2021/09/21/how-to-check-if-the-mouse-right-button-has-been-clicked/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.