这是关于HTML输入字段中的下拉历史建议是什么?

huangapple go评论62阅读模式
英文:

What is this drop down history suggestion in an input field for HTML?

问题

对于输入字段,通常会在文本字段中看到一列建议。它们被称为什么?我读到有人称之为“自动完成”,但我认为那是不同的。

这是HTML代码:

<input type="text" name="fname">

如果我删除“name=...”,这部分会消失。

英文:

For an input field, there's typically a list of recommendations I see in text fields. What are they called? I read there's something called "autocomplete" but I think that's different.

This is the html code:

  &lt;input type=&quot;text&quot; name=&quot;fname&quot;&gt;

This disappears if I remove the "name=..."

这是关于HTML输入字段中的下拉历史建议是什么?

答案1

得分: 1

自动完成是浏览器的一个功能,它会记住常见的输入字段属性,如“name”或“email”,当在其他网站上遇到类似的字段时,会建议先前输入的值。当您移除标识输入字段为特定类型(例如“name”)的属性时,浏览器无法识别它,并且不会显示先前输入的任何值。使用一致的属性名称有助于浏览器准确建议和自动填充适当的信息。希望这有意义。

英文:

Autocomplete is a browser feature that remembers common input field attributes like "name" or "email" and suggests previously entered values when it encounters similar fields on other websites. When you remove the attribute that identifies an input field as a specific type (e.g., "name"), the browser can't recognize it as such and won't display any previously entered values. Using consistent attribute names helps the browser accurately suggest and autofill the appropriate information. I hope this makes sense.

答案2

得分: 0

它实际上被称为自动完成

>自动完成允许浏览器预测值。当用户开始在字段中输入时,浏览器应显示选项以填写字段,基于先前输入的值。

您可以通过点击此链接了解更多信息。

其值可以是onoff

示例:

<input type=&quot;text&quot; name=&quot;fname&quot; autocomplete=&quot;on&quot;>

或者

<input type=&quot;text&quot; name=&quot;fname&quot; autocomplete=&quot;off&quot;>

autocomplete=&quot;off&quot; 时,它不会显示建议。但如果 autocomplete=&quot;on&quot;,它将根据您过去输入的内容显示建议。

至于为什么在删除 name=&quot;fname 时它会消失,我也不知道。

如果有人知道,请也向我解释一下。

英文:

It is actually called autocomplete.

>Autocomplete allows the browser to predict the value. When a user starts to type in a field, the browser should display options to fill in the field, based on earlier typed values.

You can read more by clicking on this link.

Its value can be on or off.

Example:

&lt;input type=&quot;text&quot; name=&quot;fname&quot; autocomplete=&quot;on&quot;&gt;

Or

&lt;input type=&quot;text&quot; name=&quot;fname&quot; autocomplete=&quot;off&quot;&gt;

When autocomplete=&quot;off&quot;, it will not show the suggestions. But if the autocomplete=&quot;on&quot;, it will show the suggestions based on what you've typed in the past.

And why it's disappearing when you remove the name=&quot;fname, I don't know either.

If anyone knows, please explain to me also.

huangapple
  • 本文由 发表于 2023年6月15日 09:38:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76478543.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定