Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html5
html forms
communitycreator

What is the autocomplete attribute of HTML elements?

Farounbi Abiola

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

Various HTML attributes provide unique features to a web page. One of these attributes is the HTML autocomplete attribute. This attribute is used to specify whether the HTML element should automatically fill in the input or not. By setting the autocomplete attribute to “on”, the browser will automatically complete the values that the user entered before.

Syntax

<element autocomplete="on/off"> 

off: The browser will not automatically complete entries when the value is set to “off”.

on: The browser will automatically complete entries, using the previously saved data when the value is set to “on”.

This attribute can be used with different HTML elements such as:

  • <form>
  • <input>
  • <textarea>
  • <fieldset>

Example

Demo of the form attribute in use

In the example given above, the autocomplete attribute at line 13 is added to the input field, which suggests values as the user types into the field.

Most of the values suggested for autocomplete depend on the browser. The values come from past values that were entered by the user before, but may also come from pre-configured values.

Implementing the autocomplete attribute in our application saves the users’ time spent on manually completing it. Therefore, this attribute helps in improving the overall user experience.

RELATED TAGS

html5
html forms
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring