w3resource

jQuery: Disable right click menu in html page

jQuery Practical exercise Part - I : Exercise-3

Disable right click menu in html page using jquery.

Sample solution :

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>Disable right click menu in html page using jquery</title>
</head>
<body>
</body>
</html>

JavaScript Code:

$(document).bind("contextmenu",function(e){
  return false;
    });

Go to:


PREV : Scroll to the top of the page with jQuery.
NEXT : Disable/enable the form submit button.

See the Pen jquery-practical-exercise-3 by w3resource (@w3resource) on CodePen.


Contribute your code and comments through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.