Disable Right Click using JQuery

In this article I am discussing how to write a simple JavaScript to disable right click on the page using JQuery.

Here I am using following jqueries. You can download from here.

jquery.min.js

Example:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisableRightClick.aspx.cs" Inherits="DisableRightClick" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html>
<
head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

    <title>jQuery disable right click</title>
    <script type="text/javascript" language="javascript">
        $(function() {
            $(this).bind("contextmenu", function(e) {
                e.preventDefault();
            });
        }); 

    </script>
</
head>

<body>
    <h3>Disable Right Click</h3>
    Purushottam Rathore<br />
    India.

</body>
</
html>

Copy and paste this code into your application and see the result.