How to focus an input field on Android browser through javascript or jquery

android, browser, focus, javascript, jquery

Solution

Actually, the general javascript function "focus" is deactivated in the android browser. Hence, the jQuery focus function is deactivated since it's using the above.

Problem

I've tried `$('#field').focus()`, and any other method found on the internet. Nothing worked. I have a simple html that reproduces the problem. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#field').focus(); }); </script> </head> <body> <input type="text" id="field" name="field"/> </body> </html> ``` Please help!

Original source