What is the way to trap a right-click event on a document element? I could not find any event handlers anywhere.
Right-click is special on many browsers, triggering the contextmenu
event rather than a click
event. Some browsers let you prevent the default behavior, some (Opera, for instance) do not. More here: http://unixpapa.com/js/mouse.html
EDIT: Rereading that page (it'd been a while), it looks like mousedown
and mouseup
are even more reliable than contextmenu
(although all major browsers trigger contextmenu
). click
, on the other hand, doesn't appear to happen at all, on any significant browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With