How to disable right click using jQuery?

jQueryWeb DevelopmentFront End Technology

To disable right click on a page, use the jQuery bind() method.

Example

You can try to run the following code to learn how to disable right click:

Live Demo

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
   $(document).bind("contextmenu",function(e){
      return false;
   });
});
</script>
</head>
<body>

<p>Right click is disabled on this page.</p>

</body>
</html>
raja
Published on 20-Dec-2017 14:01:04
Advertisements