In this article I will explain with an example, how to disable or prevent CUT, COPY, PASTE and DROP options in HTML TextBox, HTML TextArea, ASP.Net TextBox and ASP.Net Multiline TextBox using jQuery.
 
 
HTML Markup
HTML TextBox and TextArea
The following HTML Markup consists of a HTML INPUT TextBox and a TextArea (Multiline TextBox) element.
The disable CSS Class have been assigned to the HTML INPUT TextBox and TextArea (Multiline TextBox) elements.
<input type="text" class="disable" />
<br/><br/>
<textarea class="disable" rows="5" cols="5"></textarea>
 
ASP.Net TextBox and ASP.Net Multiline TextBox (TextArea)
The following HTML Markup consists of an ASP.Net TextBox and an ASP.Net Multiline TextBox (TextArea) control.
The disable CSS Class have been assigned to the ASP.Net TextBox and Multiline TextBox (TextArea) controls.
<asp:TextBox runat="server" CssClass="disable"></asp:TextBox>
<br/><br/>
<asp:TextBox runat="server" TextMode="MultiLine" CssClass="disable"></asp:TextBox>
 
 
Disabling Cut, Copy, Paste and Drop using jQuery
Inside the jQuery document ready event handler, all the elements having the CSS Class disabled are referenced and for each element, Cut, Copy, Paste and Drop event handlers have been assigned.
Inside the Cut, Copy, Paste and Drop event handlers, the event has been cancelled by calling the return false statement.
Thus, when user tries to perform Cut, Copy, Paste and Drop operations, the operation will not be performed.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    $(function () {
        var controls = $(".disable");
        controls.bind("paste", function () {
            return false;
        });
        controls.bind("drop", function () {
            return false;
        });
        controls.bind("cut", function () {
            return false;
        });
        controls.bind("copy", function () {
            return false;
        });
    });
</script>
 
 
Screenshot
jQuery Disable Cut Copy Paste and Drop options in HTML and ASP.Net TextBox
 
 
Browser Compatibility

The above code has been tested in the following browsers.

Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.

 
 
Demo
 
 
Downloads


Other available versions