I have my div with a right click popup menu:
// Attatch right click event to folder for extra options
$(\'#fBox\' + folderID).mousedown(function(event) {
You can disable the right click by appending oncontextmenu="return false;" to your body tag.
<body oncontextmenu="return false;">
One jQuery line:
$('[id^="fBox"]').on("contextmenu", function(evt) {evt.preventDefault();});
You can disable context menu on any element you want:
$('selector').contextmenu(function() {
return false;
});
To disable context menu on the page completely (thanks to Ismail), use the following:
$(document).contextmenu(function() {
return false;
});
This is a default behavior of browsers now to disable the alternate-click override. Each user has to allow this behavior in recent browsers. For instance, I don't allow this behavior as I always want my default pop-up menu.
Try this:
$('#fBox' + folderID).bind("contextmenu", function () {
alert("Right click not allowed");
return false;
});
Using jQuery:
$('[id^="fBox"]').bind("contextmenu",function(e){
return false;
});
Or disable context menu on the whole page:
$(document).bind("contextmenu",function(e){
return false;
});