Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
How to disable paste from key mobile keyboard for one-time passcodes

This below method will prevent paste when long pressing a html input field and pressing paste. However, in the case of sms one time passcode, the user can still paste the code from the top of the keyboard. How can this be prevented?

window.onload = () => {
    const myInput = 
    document.getElementById('myInput');
    myInput.onpaste = e => 
    e.preventDefault();
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can disable paste in your input as follows:

HTML:

 <input type="text" id="myinput" onpaste="return false;" ondrop="return false;" autocomplete="off" />

Javascript:

window.onload = () => {
const myInput = document.getElementById('myInput');
myInput.onpaste = e => e.preventDefault();
}

also try

myElement.addEventListener('paste', e => e.preventDefault());
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!