disable right click javascript code example
Example 1: disable right click javascript
//Disable mouse right click
$("body").on("contextmenu", function(e) {
return false;
});
Example 2: how to disable right click in javascript
// for disabling right click use this as it is
document.addEventListener('contextmenu', event => event.preventDefault());
event.preventDefault()
Example 3: disable mouse right click javascript
document.oncontextmenu = document.body.oncontextmenu = function() {return false;}
Example 4: disable right click javascript
document.addEventListener('contextmenu', event => event.preventDefault());
Example 5: disable right click javascript
document.addEventListener('contextmenu', event => event.preventDefault());