Treehouse

Disable Autocomplete, Autocapitalize, and Autocorrect

By on  

Mobile and desktop browser vendors do their best to help us not look like idiots by providing us autocomplete, autocorrect, and autocapitalize features.  Unfortunately these features can sometimes get in the way;  we don't always want or need the help they provide.  Luckily most browsers allow the developer to remove these features in the cases they aren't desired!

The HTML

Disabling these three native mobile features is as easy as a few simple HTML attributes:

<input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />

<textarea autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>

Any or all of the autocorrect, autocomplete, and autocapitalize attributes can be used on a given element to prevent the given corrective feature.

While I love these features, they aren't always applicable and when they aren't, users get frustrated.  Keep these attributes in mind when using forms on your desktop or mobile site!

ydkjs-1.png

Recent Features

  • Chris Coyier&#8217;s Favorite CodePen&nbsp;Demos

    David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...

  • 5 HTML5 APIs You Didn&#8217;t Know&nbsp;Existed

    When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It."  Can you blame us though?  We watched the fundamental APIs stagnate for so long that a basic feature...

Incredible Demos

  • External Site Link Favorite Icons Using MooTools and&nbsp;CSS

    I recently came upon an interesting jQuery article about how you can retrieve all external links within a page, build the address of the site's favorite icon, and place the favorite icon along side the link. I've chosen a different approach which...

  • MooTools Fun with&nbsp;Fx.Shake

    Adding movement to your website is a great way to attract attention to specific elements that you want users to notice. Of course you could use Flash or an animated GIF to achieve the movement effect but graphics can be difficult to maintain. Enter...

Discussion

  1. would you like to give me an example when they are not desired?

  2. Good blog post David. Useful to add autocorrect=”off” and spellcheck=”false” to input fields for things like product keys, post codes and things like that.

  3. Inputting code is another example. You don’t want things like ‘href’ or ‘var’ being marked as spelling errors.

    • And David, a tip, your reply button is a bit too well hidden. I only discovered where it was (under the profile picture) after I’d already posted my comment.

  4. Disabling auto complete is something I’ll do for credit card info, etc.
    For names and such, disabling auto correction is something you might want to do.
    The only reason I see to disable auto capitalize anywhere at all is when you have a case sensitive input field. This will, in most cases at least, have to be case transformed on the backend anyways, to take care of weird user input. I can only see that disturb a user where the input can be both lower and upper cased and should not be altered by the application in any way, shape or form. This boils down to stuff like product keys, as Christian pointed out.

    Not to be negative or anything, but Chris would’ve made a list with do’s and don’ts for each feature, I guess. Chris being Chris Coyier ;-)

  5. How about W3c validator giving errors?

  6. Instead of the W3C validator, use something like CSE HTML Validator which is more practical. There’s an online version of it too.

  7. Thanks! Unfortunately, this doesn’t work for HTC Sensation running Android 4.0.3.

  8. me

    You guys wouldn’t happen to know how to clear auto completed / keypad memory on my Micromax canvas 2 phone, short of resetting it would you?

  9. William

    I’ll give you an example.
    Im a web developer for a language services training company, and our testing services evaluate peoples ability to translate/interpret text from one language to another….
    Some people cheat by using these features, and basically let the browser take the test for them lol.

    • Jen

      I’m told that this works for most, but not for Android. Can you (or others) share what you’ve done to combat this? We have similar testing services, although not for translation.

  10. Ed

    You may also not want confidential information sent to Google for spell-checking.

  11. grovel

    Hmm, this doesn’t seem to have any effect on contenteditable-items on iOS-Safari. Any ideas how to disable this there?

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!