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.
CHECK OUT THIS TUTORIAL LIVE DEMO →
To Disable Click, Cut, Copy And Paste It Takes Only One Step:-
- 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.
Latest Tutorials
- Create Animated Skill Bar Using jQuery, HTML And CSS
- Simple And Best Responsive Web Design Using CSS Part 2
- Show Button On Hover Using HTML And CSS
- Material Design Login Form Using jQuery And CSS
- Animated Progress Bar Using jQuery And CSS
- Dynamic Drop Down Menu Using jQuery, Ajax, PHP And MySQL
- Get Website Statistics Using PHP, jQuery And MySQL
- HTML5 Login And Signup Form With Animation Using jQuery
- Facebook Style Homepage Design Using HTML And CSS
- View Webpage In Fullscreen Using jQuery