JQuery to Disable Right Click Mouse Button on a Specific Area of a Page in Asp.Net C# VB.Net

Sometimes we need to protect some specific area of a page. In that case we need to disable mouse right click on that portion of the Asp.Net page. Here in this article I will provide the JQuery code to disable mouse right click of a specific portion of a page. To do the example I am using a specific DIV of a page.

Related Articles:
1. JQuery to Disable Right Click Mouse Button on all Images in Asp.Net C# VB.Net
2. JQuery to Disable Right Click Mouse Button in Asp.Net C# VB.Net

Objective/Outcome:
JQuery to Disable Right Click Mouse Button on a Specific Area in Asp.Net Csharp VB.Net

HTML Markup to Test:

    <div id="privateDIV" style="width:100px;height:100px;background-color:Red;font-weight:bold;color:White;">
        Right CLick Here !!
    </div>

JQuery Code to Disable Right Click Mouse Button of a Specific Area of a Page:

<script type="text/javascript">
    $(document).ready(function () {

        $("#privateDIV").bind("contextmenu", function () {
            alert('Right Click Not Acceptable !!');
            return false;
        });
    });  
    </script>

Hope now you can disable mouse right click for a specific portion of a page.

Download Code Example C#        Download Code Example VB.Net

Posted in .Net, Asp.net, C#, Client, JQuery, VB.Net

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code
     
 

*