Preventing autocomplete in HTML5 email fields on iOS

by Matthew James Taylor on 21 October 2011

Preventing autocomplete in HTML5 email fields on iOS

Sometimes it can be quite frustrating to enter an email address into a form with Safari on an iPhone or iPad. Even if the field is a specific HTML5 email field (that automatically brings up an email-optimised keyboard) it can still give invalid input if autocorrect is activated. As seen in the image above, the domain name has been auto-corrected to two words by adding a space. This is pretty frustrating and also completely wrong because spaces are not allowed in emails. As an added annoyance, it also automatically capitalised matt to Matt.

Fortunately this is easy to fix. Simply add an autocorrect="off" on the email input field and this will never happen again. You can also add autocapitalize="off" to prevent autocapitalisation too. Both autocorrect and autocapitalize can also be applied to the form tag to affect all fields in the form. Nice!

PS: It looks as though this error has been corrected with the update to iOS 5.

Follow me on Twitter @mattjamestaylor

Enjoy this article?

If you find my website useful, feel free to donate any amount you wish. It will help pay for my hosting! =)

Matthew James Taylor