This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3090|Reply: 1

[JavaScript] JS prohibits copy-pasting content into a text box

[Copy link]
Posted on 2/4/2023 6:45:21 PM | | | |
Requirements: A customer service receives the customer's appeal by phone, hoping to let the customer service help modify their bank card number in the background system, in order to ensure the correctness of the information, the interface needs to enter the bank card number twice, but some customer service will enter the bank card number for the first time in order to save troubleCopy to the second confirmation card text box in the form of a copy-pasteTo avoid these issues as much as possible, some form fields need to be disabled from pasting.


The bank card number and the confirmation bank card number cannot be pasted in the form, the rendering image is as follows:




Option 1

HTML element with the onpaste attribute, the code is as follows:



Option 2

Disable pasting in input via JS code, which looks like this:



(End)




Previous:Introduction to each version of the maximum number of rows on a Microsoft Excel Sheet page
Next:Alibaba Cloud backend to view Wanwang domain name payment orders
 Landlord| Posted on 2/4/2023 6:47:11 PM |
jQuery code implementation:




Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com