Visit us on www.bitwisebranding.com for Branding, Digital Marketing and Design Solutions.

Disable right click in html page using jQuery

D
By Rahul Chauhan In Jquery

We can disable or prevent right-click on HTML page using jQuery.

bind() method jQuery

The bind() method attaches one or more event handlers for selected elements and specifies a function to run when the event occurs.

Here we have attached bind() method with current HTML document.

Code:

<!DOCTYPE html>

<html>

<head>

<title>Jquery</title>

<script type="text/javascript" src="../js/jquery-3.2.1.min.js"></script>

</head>

<body>

<h1>Disable right click in html page using jquery.</h1>

<script>

$(document).bind("contextmenu",function(e) {

return false;

});

</script>

</body>

</html>

Leave us a comment