Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

autocorrect: control automatic typing corrections

Allow or forbid typing corrections without turning a field into a text-cleaning function.

Version: HTML Living Standard

Syntax

<textarea autocorrect="on"></textarea>

The autocorrect attribute controls whether an input method may correct spelling during typing. on permits corrections and off forbids them; the permitted state does not require the browser to make any correction. An absent setting can be inherited from the owning form. Otherwise the default is enabled, subject to platform and user choices. URL, email and password fields always disable this correction behavior.

This differs from spellcheck suggestions and capitalization. Assigning a string in JavaScript does not run a dictionary over it. The autocorrect DOM property, where implemented, is a boolean reflecting the used state; do not confuse it with the textual attribute values. Support and the visible editing experience vary across engines and keyboards.

The example leaves a misspelled word unchanged after script assignment, then corrects it with an explicit application button. The isolated Chromium test verifies that button and the resulting value. It does not claim that a phone keyboard would make this correction, or that every browser implements the DOM property.

Examples

<!doctype html><meta charset="utf-8">
<label>Draft <textarea id="draft" autocorrect="on"></textarea></label>
<button id="fix" type="button">Apply explicit correction</button><output id="result"></output>
<script>
const draft = document.querySelector('#draft');
draft.value = 'teh';
const before = draft.value;
document.querySelector('#fix').addEventListener('click', () => {
  // Our own correction rule: not a test of a mobile keyboard dictionary.
  draft.value = draft.value === 'teh' ? 'the' : draft.value;
});
document.querySelector('#fix').click();
document.querySelector('#result').textContent = 'before=' + before + '; after=' + draft.value;
</script>

Result

before=teh; after=the

The correction is our explicit string replacement. No mobile keyboard dictionary is exercised.

Sources