How to disable right click using jQuery?

jquery

Nicesnippets

230

24-10-2019


Hii guys,

In this artical, i will give you example of disable right click jquery on div. If You are looking for a simple way to disable right click for any html element then here you will find the best solution to disable right click on page.

There are some reasons why you will disable the right click of mouse button.

It may be you want to show your own menu html page right click disable on a , useing the jQuery bind() method.

Example

<!DOCTYPE html>

<html>

<head>

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

</head>

<body>

<h3>Right click is disabled on this page.</h3>

<script>

$(document).ready(function(){

$(document).bind("contextmenu",function(e){

alert('right click disabled');

return false;

});

});

</script>

</body>

</html>

It will help you...


Recommended Posts