Search code examples
javascriptjqueryiphonecopy-pastepaste

How can I detect pasted text on iPhone with JS?


I'm working on a cross-platform website where the UI will change based on user input. One such change is that each time a certain input is filled, either by typing or copy-pasting, it will reveal a hidden input. The problem? Getting it to work on iPhone.

Currently I am successfully detecting copy-pastes on desktops (primarily using onKeyUp). And much to my dismay I discovered that onPaste doesn't get the job done. So that's why I'm here. Is there any kind of jQuery magic that can save this?


Solution

  • you can detect paste with. it works on phones too

    $('input').on('paste', function(){
    // do something
    });