How to disable copy content function using jQuery?

jQueryWeb DevelopmentFront End Technology

To disable cut, copy and paste of a content in jQuery, use the jQuery bind() function.

Example

You can try to run the following code to disable copy paste of content using jQuery −

Live Demo

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $('#mytext').bind("cut copy paste",function(e) {
     e.preventDefault();
  });
});
</script>
</head>
<body>

<input type = "text" id="mytext">Copy, cut and paste function doesn't work here.

</body>
</html>
raja
Published on 20-Dec-2017 14:06:08
Advertisements