Check Out The Latest Themes And Exclusive Deals And Offers On Themes
In Our Deals For Web Developers Section


Join Today And Get All The 87 Themes In Just $69! Join Today

Disable Click, Cut, Copy And Paste Using jQuery

Tuesday, Mar 7, 2017

Tags:- jQuery HTML


In this tutorial we will show you how to disable right click, cut, copy and paste using jQuery means the user will not be able to right click cut copy and paste the text of a div after disabling using this method.You may also like disable text selection using css.


See Demo
Disable Click, Cut, Copy And Paste Using jQuery


To Disable Click, Cut, Copy And Paste It Takes Only One Step:-

  1. Make a HTML file and define markup and scripting


Step 1.Make a HTML file and define markup and scripting

We make a HTML file and save it with a name disable.html

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () 
{
 $('#modify_div').bind('cut copy paste', function (e) 
 {
  e.preventDefault();
 });

 $("#modify_div").on("contextmenu",function(e)
 {
  return false;
 });
});
</script>
</head>
<body>
<div id="wrapper">

<div id="modify_div">
 <p>
  This is a sample content and This is a demo of Smooth Scrolling Div Using jQuery
  This is a sample content and This is a demo of Smooth Scrolling Div Using jQuery
 </p>
</div>

</div>
</body>
</html>

In this step we create a div and enter some sample text for click, cut, copy and paste and we use $(document).ready to disable the click, cut, copy and paste after the page load.In this we disable text operations only for 'modify_div' but you can disable text operations or any text operation for the complete webpage just insert 'body' in place of 'modify_div'.You may also like enable disable keyboard keys using JavaScript.



Thats all, this is how to disable click, cut, copy and paste using jQuery.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.

Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email