How to restrict user to copy from a textbox or paste text to textbox using javascript
This code demonstrate how to restrict user to copy from a textbox or paste text to textbox using JavaScript.
Here is the code :
<script language="javascript"> function copy() { alert("Can't copy the text"); return false; } function paste() { alert("can't paste text"); return false; } </script> <asp:TextBox ID="TextBox2" runat="server" Text="hi" oncopy="return copy();" onpaste="return paste();"></asp:TextBox>
Thanks,
Abhay
Comments
Post a Comment