How TO – Turn Off Autocomplete For Input


Previous


Next

Learn how to disable autocomplete of an input field.

Learn how to disable autocomplete of an input field.


Turn Off Autocomplete

Use the autocomplete attribute to turn off autocomplete for input fields:

Example

<!DOCTYPE html>
<html>
<body>

<h2>Autocomplete on/off</h2>

<form action=”/action_page.php”>
First name: <input type=”text” name=”fname” autocomplete=”off”><br>
Last name: <input type=”text” name=”lname” autocomplete=”on”><br>
<input type=”submit”>
</form>

<p>Fill in and submit the form, then reload the page to see how autocomplete works.</p>
<p>Notice that autocomplete is “on” for the last name field, but “off” for the first name field.</p>

</body>
</html>

You can also turn off autocomplete for the whole form:

Example

<!DOCTYPE html>
<html>
<body>

<h2>Autocomplete on/off</h2>

<p>In this example, we turn off autocomplete for the whole form.</p>

<form action=”/action_page.php” autocomplete=”off”>
First name: <input type=”text” name=”fname”><br>
Last name: <input type=”text” name=”lname”><br>
<input type=”submit”>
</form>

</body>
</html>


Previous


Next

Scroll to Top