How do disable right click in Java Script

Disable full page 

[dm_code_snippet background=”yes” background-mobile=”yes” bg-color=”#abb8c3″ theme=”dark” language=”html” wrapped=”no”]

<html>
<head>
<title>Codelizar</title>

<script src=”https://code.jquery.com/jquery-3.4.1.js”></script>

<script type=”text/javascript”>
$(document).ready(function () {
$(“body”).on(“contextmenu”,function(e){
return false;
});
</script>

</head>
<body>
<h1>Right click disabled at whole page using body tag</h1>
</body>
</html>

[/dm_code_snippet]

 

Disable Particular a div tag

[dm_code_snippet background=”yes” background-mobile=”yes” bg-color=”#abb8c3″ theme=”dark” language=”html” wrapped=”no”]

<html>
<head>
<title>Codelizar</title>

<script type=”text/javascript”>
$(document).ready(function () {
$(“#img_id”).on(“contextmenu”,function(e){
return false;
});
});
</script>

</head>
<body>
<h1>Right click disabled at image tag using image id</h1>

<img  id=”img_id” src=”https://codelizar.com/wp-content/uploads/2019/08/fifthflour.png”>
</body>
</html>

[/dm_code_snippet]