Open In App
Related Articles

HTML autocomplete Attribute

Improve Article
Improve
Save Article
Save
Like Article
Like

The HTML autocomplete Attribute is used to specify whether the input field has autocompleted would be on or off. When the autocomplete attribute is set to on the browser will automatically complete the values based on which the user entered before. It works with many input fields such as text, search, URL, email, password, date pickers, range, and color.

Syntax:

<element autocomplete="on | off"> 

Attribute Values:

  • on: It has a default value. It specifies that autocomplete is enabled.
  • off: It specifies that the autocomplete is disabled.

Example: In this example, we use autocomplete attribute value as off in the form.

HTML




<!DOCTYPE html>
<html>
<body>
    <h1>Welcome to GeeksforGeeks</h1>
    <form id="myGeeks">
        <input type="text"
               autocomplete="off"
               id="text_id"
               name="fname">
        <input type="submit">
    </form>
</body>
</html>


Output:

Setting the autocomplete attribute value to off

Applicable: The autocomplete attribute applicable for.

Example: This Example illustrates the use of autocomplete attribute in input element:

HTML




<!DOCTYPE html>
<html>
<head>
  <title>HTML autocomplete Attribute</title>
</head>
<body style="text-align:center;">
  <h1>GeeksforGeeks</h1>
  <h2>
    HTML autocomplete Attribute
  </h2>
  <form id="myGeeks">
    <input type="text"
           autocomplete="on"
           id="text_id"
           name="fname">
 
    <input type="submit">
  </form>
</body>
</html>


Output:

autocomplete attribute

Supported Browsers: 

  • Google Chrome
  • Firefox 
  • Edge 79 and above
  • Opera
  • Safari

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 24 Aug, 2022
Like Article
Save Article
Similar Reads
Related Tutorials