Why doesn't input file load the file the first time on iPhone?

  • 0
    Using JS to create an input file. The file selection dialog is invoked with click ()
    On android and other iphone everything is fine, but on iPhone 6 - iOS 12 when you select a file for the first time, the "change" event does not fire, and the second time and then it fires. How can this be explained? Maybe someone has met someone like this?
    JS code
    var fInput = document.createElement('input');
           fInput.type = 'file';
           fInput.style.display = "none";
           fInput.accept = 'image/*';
           fInput.addEventListener('change',function(){
               //.....
           });
           document.body.appendChild(fInput);
           fInput.click();
    JavaScript Anonymous, Jul 11, 2019

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!