How To Disable Cut, Copy And Paste Using Jquery ?

jquery

Nicesnippets

162

26-05-2020


Hi Dev,

In this blog, We will discuss you disable cut, copy and paste using jquery. disable whole page in cut copy paste and perticuler part in disbale cut copy and paste using jquery.

You can disable the whole page or particular part of the page. here this example,we use to bind an event to disable cut, copy and paste.

Example : Disable in Whole Page

<!DOCTYPE html>

<html>

<head>

<title>How To Disable Cut, Copy And Paste Using Jquery ? - NiceSnippets.com</title>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

</head>

<body>

<h3>How To Disable Cut, Copy And Paste Using Jquery ? - NiceSnippets.com</h3>

<p>disable fully page</p>

<script type="text/javascript">

$(document).ready(function () {

//Disable whole page

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

e.preventDefault();

});

});

</script>

</body>

</html>

Example : Disable in Perticuler Part

<!DOCTYPE html>

<html>

<head>

<title>How To Disable Cut, Copy And Paste Using Jquery ? - NiceSnippets.com</title>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

</head>

<body>

<h3>How To Disable Cut, Copy And Paste Using Jquery ? - NiceSnippets.com</h3>

<p>disable p tag</p>

<script type="text/javascript">

$(document).ready(function () {

//Disable particular part of the page

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

e.preventDefault();

});

});

</script>

</body>

</html>

It will help you...


Recommended Posts