HTML Guide
The autocomplete
attribute on an input
, textarea
, select
or form
element lets web developers specify how autocompleting should be handled.
The value none
is not valid, instead the value off
should be used to disable autocompletion.
Here is an example of how you can adjust your HTML code:
Incorrect usage:
<input type="text" name="username" autocomplete="none">
Correct usage:
If you want to disable autofill for an input field, you can use the value off
instead of none
:
<input type="text" name="username" autocomplete="off">
The attribute value is either the keyword off
or on
, or a space-separated token list that describes the meaning of the autocompletion value, for example name
, email
, postal-code
and others. Refer to the linked guide to see the full list of accepted values for the autcomplete
property.
Learn more:
Related W3C validator issues
The autocomplete attribute is used to control if the browser can provide assistance in filling out form field values, and it only makes sense for visible, not hidden, inputs.
It is available on <input> elements that take a text or numeric value as input, <textarea> elements, <select> elements, and <form> elements.
To fix this issue, you can remove the autocomplete attribute from the input element with type=hidden. Here is an example:
<!-- Wrong code -->
<input type="hidden" name="phone" value="12345" autcomplete="off">
<!-- Correct code -->
<input type="hidden" name="phone" value="12345">
The autocomplete attribute is not valid on input types that do not return numeric or text data, being valid for all input types except checkbox, radio, file, or any of the button types.
The value company is not a valid option for the autocomplete attribute on an <input> element. You may use the organization value instead, as it can be used for “company name corresponding to the person, address, or contact information in the other fields associated with this field”.
The value contact is not a valid option for the autocomplete attribute on an <input> element.
An empty string is not a valid value for the autocomplete attribute on an input element.
The autocomplete attribute controls whether the browser can autofill input values, and it requires a valid, non-empty value according to the HTML specification. Acceptable values are on, off, or specific autocomplete tokens such as name, email, username, etc. Leaving it empty, like autocomplete="", causes validation errors.
Incorrect example:
<input type="text" name="username" autocomplete="">
Correct examples: Enable browser autocomplete:
<input type="text" name="username" autocomplete="on">
Disable browser autocomplete:
<input type="text" name="username" autocomplete="off">
Use a specific token (recommended for forms that collect particular data):
<input type="email" name="useremail" autocomplete="email">
The text-anchor attribute is used within SVG elements like text or textPath to specify the alignment of text relative to a given point, but it’s not allowed on g container elements.
Here’s an example of how you can correctly use the text-anchor attribute on a <text> element in SVG:
<svg width="200" height="200">
<text x="100" y="100" text-anchor="middle">Centered text</text>
</svg>
In this example:
- The text-anchor="middle" attribute is applied directly to the <text> element.
- It aligns the text in the middle horizontally around the specified x-coordinate.
You can use the text-anchor element with the SVG elements text, textPath, tref or tspan.
The allowed values for the text-anchor attribute are start, middle or end. The value none is not valid for this attribute.
The correct way to disable autocomplete is using the value off.
Example:
<form autocomplete="off">
The correct way to disable autocomplete is using the value off.
Example:
<input type="text" name="firstName" id="firstName" required autocomplete="off" />
The correct way to disable autocomplete is using the value off.
Example:
<input type="text" name="firstName" id="firstName" required autocomplete="off" />
The value street-address cannot be used for attribute autocomplete on an <input> element. As this kind of autofill is oriented for multi-line inputs (as in the expected format for addresses), consider using a <textarea> element instead, like in this example:
<textarea name="address" autocomplete="street-address"></textarea>