如何通过JavaScript或jQuery来专注于Android浏览器中输入字段字段、器中、专注于、JavaScript

2023-09-13 01:05:19 作者:渐行渐远

我已经试过 $('#场)。重点(),并在互联网上找到任何其他方法。毫无效果。我有一个简单的HTML能重现问题。

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>

请帮忙!

推荐答案

其实,JavaScript函数焦点被停用的Andr​​oid浏览器一般。因此,jQuery的重点功能被禁用,因为它使用上面。

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.