【问题标题】:jQuery Mobile disables Mobile Safari's AutoFilljQuery Mobile 禁用 Mobile Safari 自动填充
【发布时间】:2025-12-23 07:25:12
【问题描述】:

这是专门针对 MOBILE SAFARI 的。我们不讨论其他浏览器。

好的,我有一个可以在 mac 上与 Safari 的 AutoFill 一起使用的表单,如果我删除 jQuery Mobile,它也可以在 Mobile Safari 中使用。但是,一旦我触发了 jQuery Mobile,移动 Safari 中的自动填充按钮/功能就会停止响应。 “自动填充”按钮显示为灰色。

谁能解释一下? 谢谢

** 更新 / ~ANSWER **

jQuery Mobile [v1.0a4.1] 刚刚启动并设置:

this.setAttribute("autocomplete", "off");

var textInputs = allControls.filter( "input[type=text]" );

...这一切都不同了。

见:https://github.com/jquery/jquery-mobile/issues/785

【问题讨论】:

    标签: safari jquery-mobile autofill


    【解决方案1】:

    我相信我读到这已在 1.1 版中更新,并且已修复。

    如果不是,那么您没有理由不能在需要的地方重置它,无论是在每页的基础上,还是在全局范围内......

    每页:

    $(document).delegate('yourpage','pageinit',function(){
        $(‘input[type=text]‘).attr(‘autocomplete’,'on’);
    });
    

    全球:

     $(document).bind('mobileinit',function(){
        $(‘input[type=text]‘).attr(‘autocomplete’,'on’);
     })
    

    自动完成修复来自http://ranservices.com/2011/11/jquery-mobile-breaks-autofill-on-iphone/

    【讨论】: