Reputation: 337
I want to rightclick and disable something on rightclick on my div.
Sadly the right click is not capured by StopPropagation and the right click menu of the browser is still shown...
$("#PresentationFilterBigDiv").mousedown(function (ev) {
if (ev.which == 3) {
$('#PresentationFilterDiv').css('display', 'block');
$('#PresentationFilterBigDiv').css('display', 'none');
ev.stopPropagation();
presentationMode = 1;
return false;
}
});
Upvotes: 0
Views: 37
Reputation: 167182
Try using oncontextmenu
and event.preventDefault();
:
$(document).ready(function(){
document.oncontextmenu = function() {
return false;
};
$(document).mousedown(function(e){
if( e.which == 2 ) {
alert('No don\'t use right mousebutton!');
return false;
}
return true;
});
});
Upvotes: 1