I'm trying to add some behavior for the right click event. Weirdly I simply cannot make the event handling work.
This is the jQuery code:
$('body').on('click', '#wrapper', null, function(ev){
if (ev.which === 2 || ev.which === 3){
alert("Here!");
}
});
I think that the event is fired but it cannot be identified as a "rightclick". The alert message is never shown. What am I doing wrong? Thanks you!
LE: I am able to identify the left click event with ev.which === 1. So there is no problem there.
instead of click use mousedown:
$('body').on('mousedown', '#wrapper', null, function(ev){
if (ev.which === 2 || ev.which === 3){
alert("Here!");
}
});
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