Form autocomplete 属性

定义和用法

autocomplete 属性设置或返回表单中 autocomplete 属性的值。

启用自动完成后,浏览器会根据用户之前输入的值自动完成值。

提示:可以为表单设置“开启”自动完成功能,为具体输入字段设置“关闭”功能,反之亦然。

提示:在某些浏览器中,您可能需要激活自动完成功能才能使其正常工作(请查看浏览器菜单中的“首选项”)。

另请参阅:

HTML 参考手册:HTML <form> autocomplete attibutu

实例

例子 1

Aya an fannan an fannan ko an fannan:

document.getElementById("myForm").autocomplete = "off";

Gyara ka tsa

例子 2

Rannan iyalan an fannan:

var x = document.getElementById("myForm").autocomplete;

Gyara ka tsa

语法

Rannan autocomplete attiyar:

formObject.autocomplete

Aya autocomplete attiyar:

formObject.autocomplete = an fannan ko tsa ko an fannan

Attribute value

Value Description
on Default. Browsers will automatically complete values based on the user's previous input.
off The user must enter a value in each field every time they use it. Browsers will not automatically complete entries.

Technical details

Return value: String value, indicating the state of auto-complete.

Browser support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support