Input Text autocomplete Attribute
Definition and Usage
autocomplete
Set attribute or return the value of the autocomplete attribute in the text field.
After enabling autocomplete, the browser will automatically complete values based on the user's previous inputs.
Tip:In some browsers, you may need to enable the autocomplete feature to make it work properly (check under "Preferences" in the browser menu).
See also:
HTML Reference Manual:HTML <input> autocomplete বৈশিষ্ট্য
Example
Example 1
Set the autocomplete of the text field to off:
document.getElementById("myText").autocomplete = "off";
Example 2
return the state of autocomplete:
var x = document.getElementById("myText").autocomplete;
Syntax
return autocomplete attribute:
textObject.autocomplete
set autocomplete attribute:
textObject.autocomplete = "on|off"
属性值
值 | 描述 |
---|---|
on | 默认。浏览器将根据用户之前输入的值自动完成值。 |
off | 用户每次使用都必须在每个文本字段中输入值。浏览器不会自动完成条目。 |
技术细节
返回值: | 字符串值,表示自动完成的状态。 |
---|
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |