设置焦点到输入框和显示Android键盘使用jquery手机在pageshow

前端之家收集整理的这篇文章主要介绍了设置焦点到输入框和显示Android键盘使用jquery手机在pageshow前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在设置焦点到输入框,并显示 Android键盘使用jquery手机网页显示.

我从Web上尝试过很多选项.但是没有一个在模拟器和移动设备中都能按预期工作.

这是代码

<!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="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    </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',function() {                

            });

            $(document).on('pageshow',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>

查找屏幕截图以供参考

请咨询…提前感谢…

注意:

根据Omar的评论,它在ios中正常工作….
任何人都可以建议我们如何在Android中工作?

解决方法

对我有用的解决方
$("#main").on("pageshow",function() {
$('#gotoPage').focus();
});
原文链接:https://www.f2er.com/android/313513.html

猜你在找的Android相关文章