Textbox Control with JS cannot be copied and pasted

Source: Internet
Author: User
In today's project, there is a requirement to have a Textbox (webcontrols) that cannot be copied or pasted.

At the beginning, I did not expect this event in textbox. I have been searching for it for a long time. I only wanted to find window textbox. I opened msdn and looked at the event in textbox. I didn't find anything, then I read the event of input type = text.

I found an onpaste because it is English hungry .... I don't understand. I checked it online. It was indeed this event.

The onpaste introduction in msdn is as follows:
Fires on the target object when the user Pastes data, transferring the data from the system clipboard to the document

The translation is also inaccurate, which means to control the data replication events.

Because. Net textbox is converted to HTML, but textbox does not have this event, there will be a prompt, ignore it.<ASP: textboxID= "Textbox1"Onpaste= "Return false ;"Runat= "Server" > </ASP: textbox>


Run. After a try, copy and paste the file. You cannot paste the file, but you can select copy!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.