How to Disable Right Click using jQuery

Websolutionstuff | Aug-18-2021 | Categories : jQuery

In this small post i will show you how to disable right click using jquery. Here, we will disable right click on page using jquery. we will use the jQuery bind() method for jquery disable right click. when you don't want your users to download your images at that time you can disble your right click function using jquery.

So, let's see how to prevent right click option using jquery.

 

Example : 

 

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>

<h3>How to Disable Right Click using jQuery</h3>

<script>
$(document).ready(function(){
     $(document).bind("contextmenu",function(e){
     	 alert('right click disabled');
        return false;
    });
});
</script>
</body>
</html>

 


 

You may also like :

Recommended Post
Featured Post
Laravel 8 Group By Query Example
Laravel 8 Group By Query Examp...

In this example we will see laravel 8 group by query example. how to use group by in laravel 8. As you might expect...

Read More

Nov-29-2021

How to Install PHP JSON Extension in Ubuntu 23.04
How to Install PHP JSON Extens...

Hey there! If you're working with PHP on Ubuntu 23.04 and find yourself needing JSON support, you're in the righ...

Read More

Feb-05-2024

How To Use Image Intervention In Laravel 9
How To Use Image Intervention...

In this article, we will see how to use image intervention in laravel 9. Here, we will learn about image intervention an...

Read More

Feb-13-2023

How To Install Python On Ubuntu
How To Install Python On Ubunt...

In this article, we will see how to install python on ubuntu. Python is a popular programming language. P...

Read More

May-06-2022