HTML/CSS - Input [Text] 如何禁用浏览器在下拉列表中提供建议?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2443087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:30:10  来源:igfitidea点击:

HTML/CSS - Input [Text] How to disable the browser from offering suggestings in the Dropdown?

htmlcssinput

提问by AnApprentice

I'm building an autosuggest search, like apple's spotlight... and want to disable the browser from offering text suggestions under the input box. I can't remember if that's an html or css setting and can't find it.

我正在构建一个自动建议搜索,比如苹果的聚光灯……并希望禁止浏览器在输入框下提供文本建议。我不记得那是 html 还是 css 设置并且找不到它。

Anyone remember?

有人记得吗?

回答by David says reinstate Monica

The attribute:

属性:

<form autocomplete="off">

is, I think, what you're looking for.

是,我想,你在找什么。

回答by Naeem Sarfraz

html attribute:

html属性:

autocomplete="off"

回答by Trenton Bost

To disable auto-completion of input fields, use the HTML attribute autocompletewith a value set to off.

要禁用输入字段的自动完成功能,请使用 HTML 属性autocomplete并将值设置为off

<... autocomplete="off" .../>

<... autocomplete="off" .../>