Подтвердить что ты не робот

Установить фокус на поле ввода и показать клавиатуру Android с помощью jquery mobile на страницах

Я пытаюсь установить фокус на поле ввода и показать клавиатуру Android, используя jquery mobile на страницах.

Я попробовал много вариантов из Интернета. но ни один из них не работает как в эмуляторе, так и в мобильном телефоне.

Вот код:

<!DOCTYPE html>
<html>
    <head>
        <title>Title</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
        <link rel="stylesheet" href="#" onclick="location.href='http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css'; return false;" />
    </head>
    <body>
        <div data-role="page" id="main">
            <div data-role="header"><h3>Set Focus, Show Keyboard</h3></div>
            <div data-role="content">
                <label for="gotoPage"></label>
                <input type="text" name="gotoPage" id="gotoPage" placeholder="Question No." data-mini="true"   />
            </div>
        </div>                              

        <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
        <script>
            $(document).on('pageinit',"[data-role=page]", function() {  

            });

            $(document).on('pagebeforeshow',"[data-role=page]", function() {                

            });

            $(document).on('pageshow',"[data-role=page]", function() {  
                $('#gotoPage').focus().select();                        
            }); 
        </script>
        <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>      
    </body>
</html>

Найти снимки экрана для справки

enter image description here

enter image description here

Прошу совета... Спасибо заранее...

Примечание:

Как замечает Омар, он отлично работает в ios.... любой может предложить, как мы получим работу в андроиде?

4b9b3361

Ответ 1

Решение, которое работает для меня:

$("#main").on("pageshow" , function() {
$('#gotoPage').focus();
});