4 Replies Latest reply on Mar 4, 2014 10:45 AM by Jon Tara

    ios autofocus on input

    Lisa Tassone

      Hi There,

       

      I'm trying to focus an input on page load so the keyboard is up and ready to take input.  Something like the following works fine on Android:

       

           <script type="text/javascript">

             $( '#assetList' ).on( 'pageshow', function(event, ui){

               $('.ui-page-active #search').focus();

             });

           </script>

       

      But does not work on iOS (I'm using iOS7 btw).   After a bit of searching around on the web, it seems the mobile version of Safari disables these kinds of focus events for usability reasons. Apparently you can override this in the UIWebView with a parameter called KeyboardDisplayRequiresUserAction and set this to false.  I have tried adding it to the info.plist file but it doesn't seem to fixed the issue.  Has anyone got this working on iOS or any advice to try?

       

      Thanks.