2

On paste event is not working in mobile browser. Code:

$('#textboxmyid').bind("paste", function (e) {e.preventDefault();});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" id="textboxmyid">
Ivar
  • 6,138
  • 12
  • 49
  • 61
danish
  • 21
  • 1
  • 1
    Out of curiosity, why do you want to prevent people from pasting? – Ivar Jun 15 '19 at 10:18
  • What have you investigated? Does it work in an other Browser? – Jeroen Heier Jun 15 '19 at 10:43
  • Make them type their password twice @Ivar, just a guess but that is what I have used it for no use having them confirm they typed the correct pw if just copy paste it. – Scath Jun 15 '19 at 13:29
  • @Scath In that case, [have](https://developers.google.com/web/tools/lighthouse/audits/password-pasting) [some](https://www.troyhunt.com/the-cobra-effect-that-is-disabling/) [read](https://security.stackexchange.com/questions/131106/is-there-any-reason-to-disable-paste-password-on-login) on why you never should do that. (Same applies for thinks [like emails](https://stackoverflow.com/a/1725500)). – Ivar Jun 15 '19 at 13:38
  • @JeroenHeier yes it work on desktop laptop but in mobile it not work, i need amount validation input – danish Jun 18 '19 at 05:29

0 Answers0