Skip to content
Related Articles

Related Articles

How to disable autocomplete of an HTML input field ?

Improve Article
Save Article
  • Last Updated : 06 Sep, 2021
Improve Article
Save Article

In this article, we will learn how to disable or off autocomplete features of a particular input field in HTML form. As we know that autocomplete feature is used to allow a browser whether to automatically complete filled the input data value based on the values that the user entered before. As the latest browsers supports enabled autocomplete by default. The autocomplete feature faster the process of filling the form. In case of low internet excess or session expired, if the autocomplete is enabled then the browser automatically filled the data values that the user entered before. 

Autocomplete attribute take two values:

  • on: It specifies that autocomplete is enabled.
  • off: It specifies that the autocomplete is disabled.

If you want to disabled autocomplete feature then follow the approach which are given below: 


  • First we create an HTML document that contains an <input> tag.
  • Use the <input> tag with autocomplete attribute
  • Set the autocomplete attribute to value “off”.


Example: Below code demonstrates that a form has two input fields, one with autocomplete status is on and in the other field autocomplete feature is off.


<!DOCTYPE html>
        How to disable autocomplete 
        of an HTML input field?
        h2 {
            font-family: impact;
<body style="text-align:center;">
        How to disable autocomplete 
        of an HTML input field?
    <form id="myGeeks">
        Name:<input type="text" id="text_id" 
            name="geeks" autocomplete="on">
        Address: <input type="Address" 
            name="address" autocomplete="off">
        <input type="submit">


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!