Thanks to visit codestin.com
Credit goes to www.cssportal.com

CSS Portal

HTML autocorrect Global Attribute

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The autocorrect attribute is a global HTML attribute used to control whether the browser or device should automatically correct text input in certain elements, typically <input> or <textarea>. It is primarily intended for touch-based devices, like smartphones and tablets, where software keyboards often offer automatic spelling correction. While autocorrect is not part of the official HTML specification, it is widely supported on mobile browsers (especially iOS Safari).

Purpose

The attribute allows web developers to enable or disable automatic text corrections, giving users the freedom to either rely on the device’s spelling suggestions or type freely without interference. This can be useful for fields like usernames, passwords, code snippets, or specialized terminology where autocorrection could be disruptive.

Usage

The autocorrect attribute can be added to any HTML element that accepts user input, including:

  • <input type="text">
  • <input type="search">
  • <textarea>

Example

<form>
  <!-- Autocorrect enabled (default behavior on some devices) -->
  <label for="note">Notes:</label>
  <textarea id="note" name="note" autocorrect="on"></textarea>

  <!-- Autocorrect disabled -->
  <label for="username">Username:</label>
  <input type="text" id="username" name="username" autocorrect="off">
</form>

In this example:

  • The textarea for note allows the device to suggest and automatically correct spelling errors.
  • The input for username disables autocorrection, which is important for usernames that may contain unusual characters or capitalization.

Notes

  • The attribute is case-insensitive, meaning "on" and "ON" behave the same.
  • It is often used alongside other text input attributes like spellcheck="true" or autocomplete to create a more controlled input experience.
  • Not all devices respect the autocorrect setting, so behavior may vary slightly between browsers and platforms.

Syntax

<element autocorrect="value">

Values

  • onThe browser or device should automatically correct spelling mistakes and apply autocorrections where appropriate.
  • offDisables autocorrection, allowing the user to type exactly what they input without automatic modifications.

Example

<form>
<!-- Autocorrect enabled (default behavior on some devices) -->
<label for="note">Notes:</label>
<textarea id="note" name="note" autocorrect="on"></textarea>
<br><br>
<!-- Autocorrect disabled -->
<label for="username">Username:</label>
<input type="text" id="username" name="username" autocorrect="off">
</form>

Browser Support

The following information will show you the current browser support for the HTML autocorrect global attribute. Hover over a browser icon to see the version that first introduced support for this HTML global attribute.

This global attribute is supported in some modern browsers, but not all.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!