Disable cut copy paste operation on a textbox using asp.net/javascript

Introduction:

In this article I am going to explain about how to disable cut , copy and paste operation on a textbox

Description:

Some time for some security purpose we need to restrict the user from cut,copy and paste operation on a textbox. We can achieve it using a simple code which is given below. For this we are using three client side events oncopy,onpaste,oncut.

Code:

<asp:TextBox ID=”txtTest” runat=”server” oncopy=”return false” onpaste=”return false”
    oncut=”return false”>
</asp:TextBox>
Thus the above code returns false on cut, copy and paste operation.

Do you like this article. Then comment here or share with your friends. Or like our facebook page.


Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!