
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML autocomplete Attribute
The autocomplete attribute of the <input> element allows you to set whether the autocomplete for the input should be on or off. The web browser automatically fills the values if autocomplete is on. This only happens if the user already entered values before.
Following is the syntax −
<input autocomplete="on|off">
Above, on | off values are to be set for autocomplete to appear or not. Set on if you want the browser to complete the entries based on previously entered values, whereas off doesn’t allow to complete the entries.
Let us now see an example to implement the autocomplete attribute of the <input> element −
Example
<!DOCTYPE html> <html> <body> <h2>Points</h2> <form action = "" method = "get"> Player − <input type = "text" name = "player" autocomplete = "on"><br> Rank − <input type = "number" name = "rank"><br> Points − <input type = "number" name = "pts"><br> <button type = "submit" value = "Submit">Submit</button> </form> </body> </html>
This will produce the following output. Let’s say we previously entered some values and we have now set autocomplete −
In the above example, we have added a form −
<form action = "" method = "get"> Player − <input type = "text" name = "player" autocomplete = "on"><br> Rank − <input type = "number" name = "rank"><br> Points − <input type = "number" name = "pts"><br> <button type = "submit" value = "Submit">Submit</button> </form>
We have set the autocomplete as on for one of the input −
Player − <input type = "text" name = "player" autocomplete = "on">
Therefore, when you will place cursor on Player input type, then you will able to see the values entered before.
- Related Articles
- HTML autocomplete Attribute
- HTML DOM Input Email autocomplete Property
- HTML DOM Input URL autocomplete Property
- HTML DOM Input Search autocomplete Property
- HTML DOM Input Text autocomplete Property
- How to use autocomplete attribute in HTML?
- HTML input readonly Attribute
- HTML input value Attribute
- How to disable autocomplete of an HTML input field?
- Autocomplete text input for HTML5?
- HTML DOM Form autocomplete Property
- How to use different step attribute in one range input in HTML?
- HTML pattern Attribute
- HTML novalidate Attribute
- HTML maxlength Attribute
