MyInternships.in

HTML Attributes

HTML <input> autocomplete Attribute

The autocomplete attribute controls whether the browser may automatically fill in an input's value. Meaningful tokens help browsers autofill accurately.


The <input> autocomplete Attribute

The autocomplete attribute tells the browser whether, and how, it should help fill in a form field using previously stored values. On <input>, <textarea> and <select>, it accepts on, off, or specific tokens that describe the expected data so the browser can autofill accurately.

Syntax

ℹ️

Syntax: <input autocomplete="token">. The value is on, off, or a standard token such as email, name, tel or street-address.

The basic pattern
Example
<input type="email" name="email" autocomplete="email">

Example

Run the example and focus a field — your browser may offer to autofill it based on the token you provided.

Contact form with autofill tokens
Example
<!DOCTYPE html>
<html>
  <body>
    <form>
      <label for="n">Full name</label><br>
      <input type="text" id="n" name="fullname" autocomplete="name"><br><br>

      <label for="e">Email</label><br>
      <input type="email" id="e" name="email" autocomplete="email"><br><br>

      <label for="p">New password</label><br>
      <input type="password" id="p" name="new-pass" autocomplete="new-password"><br><br>

      <button type="submit">Save</button>
    </form>
  </body>
</html>

Attribute Values

ValueDescription
onAllow the browser to autofill this field (default behaviour)
offDisable autofill, e.g. for sensitive or one-off fields
nameFull name
emailEmail address
telTelephone number
new-passwordA new password, hinting password managers to suggest one
💡

Use meaningful tokens rather than off wherever possible. Correct tokens improve accessibility and speed up form completion for users on mobile devices.

Key Takeaways

  • autocomplete controls whether and how a field is autofilled.
  • It works on <input>, <textarea> and <select>.
  • Prefer descriptive tokens like name, email and tel over off.
  • Use new-password to help password managers suggest strong passwords.
  • Good tokens speed up form filling, especially on mobile.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships