Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

Disable right click context menu cut, copy, paste

4.48/5 (12 votes)
5 Aug 2011CPOL 38.3K  
DescriptionD...

Description


Disable Right Click using jQuery

Code


HTML
<html>
<head>
<title>Disable Right Click using jQuery</title>
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
$(function() {
     $(this).bind("contextmenu", function(e) {
         e.preventDefault();
     });
}); 
</script>
</head>
<body>
Disable Right Click using jQuery
</body>
</html>

Browser Compatibility


I have tested this script in the following Web browsers:

  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari
  • Opera

jQuery


Download Latest jQuery - http://jquery.com/[^]
jQuery Tutorial - http://www.w3schools.com/jquery/default.asp[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)