开发者

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

I'm building an autosuggest search, like appl开发者_开发问答e'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.

Anyone remember?


The attribute:

<form autocomplete="off">

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


html attribute:

autocomplete="off"


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

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


This doesn't work in modern browsers. Use:

<div contenteditable="true"></div>

If you need pleaceholder add css:

[contenteditable="true"][placeholder]:after {
    content: attr(placeholder);
    color: #abb4cd;
}
[contenteditable="true"][placeholder]:not(:empty):after {
    display: none;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜