• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Electric Toolbox Blog

The Electric Toolbox Blog

Linux, Apache, Nginx, MySQL, Javascript and PHP articles

  • Applications
  • FCKEditor
  • Apache
  • Windows
  • Contact Us
Home / Switch off autocomplete for an HTML form field

Switch off autocomplete for an HTML form field

Auto complete in form fields in web browsers can be extremely useful for helping a user to quickly complete a form. However there are times when you want to disable it, for example with the fields on a credit card payments form. This post looks at how to switch off autocomplete for an HTML form field.

The screenshot below shows auto complete in action on an example credit card form. As I started typing in the number 4 it offered a drop down box with all the cards entered that had started with 4 (in this example it only had a sample card number in the autocomplete history).

The red arrow in the screenshot shows the auto complete box.

example of auto complete working

You really don’t want auto complete enabled for credit card fields in a form so this is a good example of a form field where it should be disabled.

A normal text field might look like this:

<input type="text" name="first_name" value=""  />

To switch off autocomplete simply add autocomplete="off" like so:

<input type="text" name="first_name" value="" autocomplete="off"  />

That’s all there is to it. Now the auto complete popup won’t appear for that field.

Check Out These Related posts:

  1. Toggling a password field between plain text and password
  2. How to use a flash card reader with Linux
  3. HTML form honeypots and autofill/autocomplete
  4. jQuery: show plain text in a password field and then make it a regular password field on focus

Filed Under: HTML And CSS

Primary Sidebar

Categories

  • Apache
  • Applications
  • Article
  • Case Studies
  • Email Servers
  • FCKEditor
  • HTML And CSS
  • Javascript
  • Linux/Unix/BSD
  • Microsoft SQL Server
  • Miscellaneous Postings
  • MySql
  • Networking
  • Nginx Web Server
  • Offsite Articles
  • OSX
  • PHP
  • Quick Tips
  • RFC – Request for Comments
  • SilverStripe
  • VMWare
  • VPN
  • Windows
  • WordPress

Recent Posts

  • Vim Show Line Numbers
  • Add User To Group Linux
  • Chmod 777 Tutorial
  • How to Copy Directory Linux
  • Linux create user

Copyright © 2021. ElectricToolBox. All Rights Reserved.

  • Contact Us
  • Copyright Info
  • Privacy Policy
  • Sitemap