Click here to Skip to main content
15,887,942 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I have placed a textarea in page.
I have given onpaste=return false, So I not allowing the user to copy the content.
But when drag and drop the content in the text area it allows the action.
Kindly suggest what I can do for this issue.


Regards,
AP
Posted
Updated 27-Feb-21 15:05pm
v2
Comments
Stephen Hewison 9-Jun-12 13:49pm    
Are you trying to stop the user selecting the text and copying from your page, or trying to stop them pasting content into your page? Or trying to stop them copying text from one part of your page to another?
Arunprasath Natarajan 10-Jun-12 4:58am    
2nd and 3rd option

As Pankaj suggests you can stop the drop action using:

JavaScript
ondrop="return false;"


As you've already suggested you can stop the paste action using:

JavaScript
onpaste="return false;"


You can also stop the user selecting text from any part of your website by using the following on the relevant elements:

JavaScript
onselectstart="return false;"
 
Share this answer
 
v2
You can use the following property to disable the drops on the textbox.

JavaScript
ondrop="return false;"
 
Share this answer
 
Comments
[no name] 10-Jun-12 7:42am    
5
Pankaj Nikam 10-Jun-12 7:59am    
Thank you :)
onselectstart="return false" onpaste="return false;" onCopy="return false" onCut="return false" onDrag="return false" onDrop="return false" autocomplete=off
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900