In this article I will explain with an example, how to disable or prevent Cut, Copy and Paste operations in HTML Input TextBox and TextArea and ASP.Net Single and MultiLine TextBox using JavaScript.
The solution provided disables the Cut, Copy and Paste operations in both cases that is using CTRL key as well as using browser context menu on Mouse Right click.
 
 
Disable Cut Copy and Paste in ASP.Net TextBox and Multiline TextBox
The following HTML Markup consists of HTML TextBox, HTML TextArea and ASP.Net TextBox which are assigned with CssClass disabled.
Inside the window onload event handler, all the elements having the Css Class disabled are referenced and for each element, Cut, Copy and Paste event handlers are attached using JavaScript.
Inside the Cut, Copy and Paste event handlers, the event is cancelled using the preventDefault function.
Now whenever user tries to perform Cut, Copy and Paste operations, the operation is not performed.
The best part of this snippet it not only disables the Cut, Copy and Paste operations with CTRL button but also disables it on Mouse Right Click without disabling Right Click functionality.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        window.onload = function () {
            var controls = document.getElementsByTagName("*");
            var regEx = new RegExp("(^| )disable( |$)");
            for (var i = 0; i < controls.length; i++) {
                if (regEx.test(controls[i].className)) {
                    AttachEvent(controls[i], "copy");
                    AttachEvent(controls[i], "paste");
                    AttachEvent(controls[i], "cut");
                }
            }
        };
        function AttachEvent(control, eventName) {
            if (control.addEventListener) {
                control.addEventListener(eventName, function (e) { e.preventDefault(); }, false);
            } else if (control.attachEvent) {
                control.attachEvent('on' + eventName, function () { return false; });
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    ASP.Net<br /><br />
    <asp:TextBox ID="TextBox2" runat="server" CssClass="disable"></asp:TextBox><br /><br />
    <asp:TextBox ID="TextBox1" runat="server" TextMode = "MultiLine" CssClass="disable"></asp:TextBox><br /><br /><br />
    HTML<br /><br />
    <input type = "text" class = "disable" /><br /><br />
    <textarea class = "disable" rows = "5" cols = "5"></textarea>
    </form>
</body>
</html>
 
 
Screenshot
Disable Cut Copy and Paste in ASP.Net TextBox and Multiline 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