
- 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
How to disable autocomplete of an HTML input field?
To disable autocomplete of an input field, the code is as follows −
Example
<!DOCTYPE html> <html> <head> <style> input{ font-size: 18px; padding: 10px; margin: 10px; border:1px solid grey; } </style> </head> <body> <h1>Autocomplete on/off Example</h1> <form> First name: <input type="text" name="firstName" autocomplete="off"><br> Last name: <input type="text" name="lastName" autocomplete="on"><br> <input type="submit"> </form> <h2>Type in the above fields and refresh page to see autocomplete at work</h2> </body> </html>
Output
The above code will produce the following output −
On typing something in the above fields after submitting the form one time −
- Related Articles
- How to include an input field in HTML?
- HTML DOM Input URL autocomplete Property
- HTML DOM Input Search autocomplete Property
- HTML DOM Input Text autocomplete Property
- HTML DOM Input Email autocomplete Property
- How to use input type field with date field in HTML?
- How to disable/enable an input box with jQuery?
- How to use autocomplete attribute in HTML?
- How to use input type field with steps in HTML?
- How to give a limit to the input field in HTML?
- Autocomplete text input for HTML5?
- HTML autocomplete Attribute
- HTML autocomplete Attribute
- How do we include the legal number intervals for an input field in HTML?
- How to use input type field with the color picker in HTML?

Advertisements