HTML autocomplete attribute

HTML autocomplete attribute: It defines that a form/ input files having the autocomplete on/off. And this attribute helps the browser for predicting the values. i.e. If a user starts typing in the fields they should display the options to fill the field, basing upon the early results.

HTML autocomplete attribute

This attribute is having the <form> and <input> as elements with autocomplete attribute. And also the autocomplete attribute works with input types like text, URL, search, tel, email, password, date pickers, range, and color.

Supported Browsers

This attribute supports different browsers as follows:

  • Google
  • Internet Explorer

Example: Input (autocomplete on and  off for input field)

<form action="/action_page.php" autocomplete="on">
  First name:<input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  E-mail: <input type="email" name="email" autocomplete="off"><br>
  <input type="submit">
</form>

Output:

HTML autocomplete input attribute

Example: Form with autocomplete On

<form action="/action_page.php" method="get" autocomplete="on">
  First name:<input type="text" name="fname"><br>
  E-mail: <input type="email" name="email"><br>
  <input type="submit">
</form>

Output:

HTML autocomplete attribute form on