简体   繁体   English

Chrome 正在使用占位符自动填充我的 select2 输入

[英]Chrome is autofilling my select2 input with its placeholder

I'm currently experiencing a very annoying problem with Google Chrome.我目前在使用 Google Chrome 时遇到了一个非常烦人的问题。 I have some filters that are a multi-select and when I click to type on those filters, chrome suggests as an autofill option the placeholder for that select.我有一些过滤器是多选的,当我点击在这些过滤器上输入时,chrome 建议作为自动填充选项该选择的占位符。 I've never typed that text on this field, Chrome is getting that from the placeholder of the input.我从来没有在这个字段上输入过那个文本,Chrome 是从输入的占位符中获取的。

Chrome 自动填充占位符动图

Also, it seems that Google saved that placeholder as a "suggestion" to fill data on forms.此外,Google 似乎将该占位符保存为填写表单数据的“建议”。铬配置

I've already tried to set those fields as autocomplete="off" and autocomplete="new-password and it did not work.我已经尝试将这些字段设置为autocomplete="off"autocomplete="new-password ,但它不起作用。

If I disable Chrome Option to autofill addresses, phone numbers and etc, this problem goes away.如果我禁用 Chrome 选项来自动填充地址、电话号码等,这个问题就会消失。

I would like to be able to suppress chrome from suggesting this since it does not make any sense and makes using the filter a pain.我希望能够抑制 chrome 提出这一点,因为它没有任何意义并且使使用过滤器变得痛苦。 I'm not sure if this is a chrome bug, a bug with select2, a combination of both.我不确定这是否是 chrome 错误、select2 错误、两者的组合。 I've been looking everywhere on the internet to a solution and could not find one, does anybody know how to solve this?我一直在网上到处寻找解决方案,但没有找到,有谁知道如何解决这个问题?

To turn off the auto suggestions which are displayed in chrome try adding要关闭 chrome 中显示的自动建议,请尝试添加

<input autocomplete="off">

Even after adding this if chrome tries to give you auto suggestion, the most widely used technique is to add an hidden input field above your field to solve this problem如果 chrome 试图给你自动建议,即使添加了这个,最广泛使用的技术是在你的字段上方添加一个隐藏的输入字段来解决这个问题

<input style="display:none" type="password" name="pass"/>

Adding this above input must solve the problem添加这个上面的输入必须解决问题

Try to add another select2 with display="none", visibility="hidden" and autocomplete="off" before that one and see if the problem goes away.尝试在那个之前添加另一个带有 display="none"、visibility="hidden" 和 autocomplete="off" 的 select2,看看问题是否消失。

Had this issue with a password input a while ago and that did the trick.前一阵子输入密码时遇到了这个问题,这解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM