如何在Chrome中禁用某些字段的用户名自动填充功能?

时间:2019-12-11 07:58:45

标签: javascript html google-chrome

我有一个简单的搜索输入,会在auth之后显示,但是chrome尝试用用户名填充它。

enter image description here

<input type="hidden" class="hidden" name="username">
<input type="search" class="form-control" id="input-search" placeholder="@lang('search.search_site')" value="{{ request()->get('search', '') }}" autocomplete="none" name="search-input">

尝试了不同的方法,但仍建议在此处使用用户名。我认为是因为它是页面上的第一个输入。...

P.S。 尝试自动完成:关闭,否,无

2 个答案:

答案 0 :(得分:0)

Add autocomplete="off" onto <form> element;
Add hidden <input> with autocomplete="false" as a first children element of the form.
     

尝试一下:

<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
  

您还可以创建几个字段,并使用   “ display:none”

<input style="display:none" type="text" name="user_name"/>

答案 1 :(得分:0)

这也让我有些疯狂。像这样绕下去。

<input type="number" id="your-id" class="form-control text-center border-success" 
placeholder="Enter desired code" />

$(function() {
        $('#your-id').attr("type","text");
});

HTH:)