已启用Chrome自动填充功能,但未填写

时间:2017-12-17 09:09:41

标签: javascript html google-chrome autofill

我有一个适用于Safari的表单,但不适用于Chrome自动填充。

Screen shot autofill suggestion

Screen shot after selected "Adriaan"

生成输入字段的代码:

Array.prototype.forEach.call(vars, function(variable) {
        modal = modal + " \
        <div class='form-group row' style='padding-left: 5%; padding-right: 5%;'> \
            <div class='input-group'> \
                 <span class='input-group-addon' id='"+variable+"icon'><i class='fa "+icons[variable]+"' aria-hidden='true'>&nbsp;</i><label for='"+variable+"'>"+labels[variable]+"</label></span> \
                 <input type='"+types[variable]+"' name='"+names[variable]+"' id="+variable+" placeholder='"+placeholders[variable]+"' required autocomplete='"+autocomp[variable]+"' autocomplete='on' class='form-control' style='position: relative;'></input> \
            </div> \
        </div>";
});

在网页上生成的HTML代码:

<div class="form-group row" style="padding-left: 5%; padding-right: 5%;">                                               
   <div class="input-group">                                                        
       <span class="input-group-addon" id="firstnameicon"><i class="fa " aria-hidden="true">&nbsp;</i><label for="firstname">First Name</label></span>                                                  
       <input type="text" name="fname" id="firstname" placeholder="John" required="" autocomplete="given-name" class="form-control" style="position: relative;">                                                
   </div>
</div>

有什么想法让这个自动填充工作正常吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

只是一个建议,您是否尝试过生成autocomplete="on"而不是autocomplete="given-name"

来自[w3school][1]

的来源