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();
}
You can disable paste in your input as follows:
HTML:
Javascript:
also try