HTML5 autocomplete attribute

HTML5 autocomplete is the next article in the series of HTML5 attributes that impact accessibility. Autocomplete is a new attribute in HTML5 specification. It is an attribute of input element.

Using HTML5 autocomplete attribute

The autocomplete attribute is used along with HTML5 input element. This attribute informs if the field has the property to remember the similar values entered by the user earlier. The autocomplete attribute predicts the value and provide suggestions to the user based on earlier typed values.

The autocomplete attribute has two possible values on and off. autocomplete=”off” is equal to not having the attribute at all. Some browsers by default remembers the values depending on the field type. If you want the user agent not to remember the value at all, eg: input fields such as one time passwords (OTP) use autocomplete=”off” specifically.

autocomplete=”on” is the default value and is equal to having only autocomplete without the value. Use either “autocomplete” or autocomplete=”on” for fields such as email address so that each time you fill in a registration form or login to a website you can type in few characters and choose the value.

Example code below.

<br /> <input type="tel" autocomplete="on" /><br /> <input type="email" autocomplete="off" /><br /> <input type="text" autocomplete /><br /> <input type="url" /><br />

The HTML5 autocomplete attribute is allowed on the following input types. text, search, url, tel, email, password, datepickers, range, and color. Remember that the screen readers must announce the autocomplete property to the user whenever it is available.

Have a look at the live example.

Related links

Comments are closed.