Disabling Auto-Correct And Auto-Capitalize Features On iPhone Inputs

Posted January 5, 2012 at 9:29 AM by Ben Nadel

Tags: HTML / CSS

Over the weekend, I read Mobile First by Luke Wroblewski. In his book, Wroblewski mentioned that in order to create the most usable experience on a mobile device, one should probably turn off the auto-correction and auto-capitalization features for input fields that don't require them. This way, users don't have to worry about their email addresses being capitalized or their names being "corrected." I really loved this idea; but, Wroblewski didn't get into any code. After a bit of Googling, however, I found that both of these auto-input features could be disabled with a simple HTML attribute.


 
 
 

 
  
 
 
 

Googling quick brought me to Apple's "How-To" guide for coding Safari for iPhone. In it, there was a section that perfectly answered my question: "How do I disable automatic correction and automatic capitalization in text fields or text areas?" As it turns out, auto-correction and auto-capitalization can be disabled with one HTML attribute (each):

  • autocorrect="off"
  • autocapitalize="off"

That seems simple enough. To experiment with this, I put together a quick demo and opened it up in my iPhone Simulator (which you can see in action in the above video):

  • <!DOCTYPE html>
  • <html>
  • <head>
  • <title>Disable Auto-Correct And Auto-Capitalization On iPhone</title>
  •  
  • <!---
  • Use the device width as the initial width of the
  • viewport. This way, we will have a zoom that is relevant
  • to our mobile app.
  • --->
  • <meta name="viewport" content="width = device-width" />
  • </head>
  • <body>
  •  
  • <h1 style="font-size: 16px ;">
  • Disable Input Field Auto-<br />
  • Features on iPhone
  • </h1>
  •  
  • <form>
  •  
  • <p>
  • Normal Input:<br />
  • <input type="text" style="width: 180px ;" />
  • </p>
  •  
  • <!--
  • On this in put, we will add the two "auto" attributes
  • to turn off auto-correct and auto-capitalization.
  • -->
  • <p>
  • No-Auto Input:<br />
  • <input
  • type="text"
  • autocapitalize="off"
  • autocorrect="off"
  • style="width: 180px ;"
  • />
  • </p>
  •  
  • </form>
  •  
  • </body>
  • </html>

That's all there is to it! These features, combined with using the right input type to trigger the right keyboard, should help keep the mobile experience as usable as the desktop experience.




Reader Comments

Jan 5, 2012 at 11:29 AM // reply »
160 Comments

I was curious if the autocorrect would also disable keyboard shortcuts in iOS5 and it does *not*.

This is nice because I've set up a shortcut of @@ to insert my e-mail address.

This means user defined shortcuts still work, it only affects spelling corrections.

Now if I could just figure out how to insert a keyboard shortcut in iOS w/out inserting an extra character (like a space or punctuation.) I always think I can click the entry to add it, but it never works.


Jan 5, 2012 at 11:30 AM // reply »
10,652 Comments

@Dan,

What are these "shortcuts" you speak of? Is this a feature of the operating system? I've not heard of them before.


Jan 5, 2012 at 12:33 PM // reply »
1 Comments

@Ben,

Shortcuts were introduced in iOS 5 I believe. You can get to them by:
Settings.app -> General -> Keyboard -> Shortcuts.


Jan 5, 2012 at 12:36 PM // reply »
10,652 Comments

@Devin,

Awesome sauce!! This looks like it could definitely be helpful :D I'll put my thinking cap on, see what kind of repetition I use in my life. Thanks!


Jan 5, 2012 at 12:54 PM // reply »
336 Comments

Cool, even though I don't have an iPhone. I have a droid. Sometimes I wish I could turn the autocorrect feature off of the swype function, but I guess that whole function more or less depends upon an autocorrect-like functioning. Blah. Other than that, the swype function is nifty if you are driving and texting, and also the talk-to-text feature as well. And for the record, I don't like texting and driving as a habit, but every now and then, someone will text me while I am driving, and it may be a really long interstate road, and I may not want to pull off an exit to simply say "yes" to someone's question. But I would probably never text and drive if I didn't have swype or talk-to-text. That would definitely make it way too dangerous. Swype and talk-to-text makes it much easier. I know New Yorkers don't really have to worry about that as much. It does seem to save a lot of time, also. A friend and I were comparing our droid and iPhone, and there were things like the talk-to-text and swype that I really liked about my droid, and he said the iPhone did not have it.

Yeah, about those keyboard shortcuts...I have accidentally hit them before, and it nearly killed me to get the screen back to "normal". Or when you accidentally hit a keyboard shortcut and it makes your taskbar go all heywire, or blows up your screen and takes away your navigational tools. lol. I guess I have clumsy fingers.


Jan 5, 2012 at 3:12 PM // reply »
147 Comments

I love autocorrect - for the most part.


Jan 5, 2012 at 4:37 PM // reply »
254 Comments

@Ben,

I hate that bad-guessing autocorrect so much, I disable it on all my iDevices. But it STILL sometimes highlights a word [in pink] to suggest an alternative from time to time. If I don't notice it instantly, before I type the very next character, it throws away everything it highlighted.

That misbehavior is a deficiency in its own right, but it caused me to notice another deficiency: You know what iOS needs? Undo.

Not to undo what YOU'VE done. To undo what IT'S done, incorrectly, on your behalf.


Jan 11, 2012 at 12:20 PM // reply »
150 Comments

@WebManWalking,

Agreed. AutoCorrect is still on on my Android, but I turned it off when I had my iPhone3G. Annoying.

But thanks for the @@ shortcut idea. Will turn that on the iPad for sure.


Jan 13, 2012 at 1:46 PM // reply »
2 Comments

Where did you get the nifty iPhone Simulator?


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
InVision App - Prototyping Made Beautiful With Prototyping Tools Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Feb 22, 2012 at 7:59 PM
Ask Ben: Simple Data Caching In ColdFusion
Hi Ben any suggestions on how to improve the following: <cffunction name="CacheUsers" access="public" output="no" returntype="void"> <cfquery name=& ... read »
Feb 22, 2012 at 6:14 PM
Using CAPTCHA In ColdFusion 8
@devlosh, Unfortunately I do not have a solution for this yet, sorry! ... read »
Feb 22, 2012 at 6:11 PM
Using CAPTCHA In ColdFusion 8
@devlosh, ... read »
Feb 22, 2012 at 2:36 PM
ColdFusion 10 Beta - Closures And Components And The THIS Scope
@Tyler, What we really need is our friendly call() and apply() methods from JavaScript ! That would be sweet. I haven't played with the invoke() method, but I assume it's just the CFScript-based eq ... read »
Feb 22, 2012 at 2:14 PM
ColdFusion 10 Beta - Closures And Components And The THIS Scope
Hey Ben, it is funny you post this as I just ran into an issue here. http://tylerclendenin.com/2012/02/coldfusion-zeus-10-beta-function-expressions-and-closures-not-quite-there/ I posted two bug ... read »
Feb 22, 2012 at 2:09 PM
Back To The Fusion - Part X
Ben, didn't I see you tweet something about a beta? I can't believe it's been a year since you posted this! ... read »
Feb 22, 2012 at 1:38 PM
Experimenting With jQuery's Queue() And Dequeue() Methods
Excellent explanation, thanks for the post. I have only one question, how do i get to the last effect in queue without execute others effect. ... read »
Feb 22, 2012 at 9:39 AM
Ask Ben: Reading In A File Using CFFile And CFInclude
@GrumpyCFer, that may surprise you (what you "can't imagine"), but it really would not surprise me at all. The things people think and assume about CF (wrongly, to their peril), stuns me. ... read »