Disable/Prevent Cut, Copy and Paste in TextBox in ASP.NET

Disable cut, copy & paste in a TextBox using Javascript.

<asp:TextBox ID="MyTextBox" runat="server" oncopy="return false" onpaste="return false" oncut="return false"></asp:TextBox>

Disable cut, copy & paste in TextBox using JQuery

<asp:TextBox ID="MyTextBox" runat="server" ></asp:TextBox>
 

<script type="text/javascript">

        $(document).ready(function () {

            $('#MyTextBox').bind('copy paste cut', function (e) {

                e.preventDefault(); //disable cut,copy,paste

            });

        });

</script>

Note: Both the methods mentioned above, to prevent the cut, copy and paste event of TextBox, works on all the version of all the browsers.

Ebook Download
View all
Learn
View all