Disabling Cut,Copy and Paste i.e. Ctrl+X,Ctrl+C and Ctrl+V options on Textbox on Web Page

Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 1676
It's sometimes required to disable cut,copy and paste for Textbox control on web page,mostly for passwords.

To achieve such things,simply write:-

//For Disabling Cut Option
<input type="text" oncut = "return false;" />

//For Disabling Copy Option
<input type="text" oncopy = "return false;" />

//For Disabling Paste Option
<input type="text" onpaste = "return false;" />

//For Disabling All options i.e. Cut,Copy and Paste for Textbox
<input type="text" oncopy = "return false;" onpaste = "return false;" oncut = "return false;">

Comments or Responses

Posted by: t5j9033387989 on: 12/20/2013 Level:Starter | Status: [Member] | Points: 10
nice one thanks for posting

Login to post response