Logo

Office Address

123/A, Miranda City Likaoli
Prikano, Dope

Phone Number

+0989 7876 9865 9

+(090) 8765 86543 85

Email Address

info@example.com

example.mail@hum.com

How to Disable Mouse Right Click using jQuery

To Prevent Content theft right-click disable players a mail role this is the common issue faced by website and blog owners. This can be controlled by disabling right-click on websites. Disabling mouse right-click will prevent the context and inspect the codes of the website, thereby preventing the page contents from being copied. with the help of jquery and javascript, the disable of right-clicking can be implemented. 

Disable Right Click on Website:

You can avoid copying the contents of your website in two ways. One is to disable the right-click context menu altogether and the other is to simply disable the cut, copy and paste operations.

1) To disable the right-click event on the entire web page, use the below script,

<script type="text/javascript">
$(document).ready(function(){     
    $(this).on('contextmenu', function(e){
        e.preventDefault();
    });
});
</script>


2) To disable the context menu on the mouse right-click only on part block or element, use the element id, class, or the element itself. use the below script 

<script type="text/javascript">
$(document).ready(function(){
    $('#id').on('contextmenu', function(e){
        e.preventDefault();
    });
});
</script>

3) To disable right-click context menu on the whole page but except on the editable element like text,text area, use the below 

<script type="text/javascript">
$(document).ready(function(){
    $(this).on('contextmenu', function(e){
        if(e.target.nodeName != "TEXTAREA"){
            e.preventDefault();
        }
    });
});
</script>

 

Tags

  • Disable right click javascript w3schools

  • How to disable right click in HTML using javascript

  • How to disable right click on div

  • Disable right-click and f12 jquery
  • Disable right click on the browser using jquery
  • How to disable right click in HTML using CSS

  • How to disable right click in embed tag using javascript

  • disable right click jquery

Related Posts

How to Disable Mouse Right Click Using jQuery, Disable Right Click on Website

website design and development company for textile industries

Blazingcoders is a web design and development company working for various textile and apparel compan

Read More
How to Disable Mouse Right Click Using jQuery, Disable Right Click on Website

Business Directory and Listing Development

Blazingcoders provides directory and listing website development services. A Business Directory webs

Read More
How to Disable Mouse Right Click Using jQuery, Disable Right Click on Website

PHP CodeIgniter - Basic CRUD operation with MySQL Database with example

In this Post PHP CodeIgniter 4 instructional exercise, I will tell you the fundamental CRUD usefulne

Read More