HDTuto.com

How to Disable Mouse Right Click Cut Copy and Paste using JQuery?



In this post, we will learn disable right click jquery on page. i would like to show you jquery disable right click and copy. Here you will learn jquery disable context menu for element. if you have question about javascript disable right click copy paste then i will give simple example with solution. you will do the following things for jquery prevent copy paste.

we will use context menu for disable mouse right click.

we will use bind event with cut copy paste operation for preventing copy, cut and paste options. you can same perform with javascript to prevent right click.

In this example, we will simple include jquery using cdn file. than we will write code to disable cut copy paste from whole page after that write contextmenu event for disable mouse right click. So let's just see bellow html code and use it.

Example:

<!DOCTYPE html>

<html>

<head>

<title>Jquery disable right click, cut, copy and paste example - ItSolutionstuff.com</title>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>

<body>

<h1>Jquery disable right click, cut, copy and paste example - ItSolutionstuff.com</h1>

<script type="text/javascript">

$(document).ready(function () {

//Disable cut copy paste

$(document).bind('cut copy paste', function (e) {

e.preventDefault();

});

//Disable mouse right click

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

return false;

});

});

</script>

</body>

</html>

I hope it can helper you...




May 22, 2020 | Category : JQuery



Blog Search


Copyright © 2020 HDTuto.com. All rights reserved.