The autocomplete Attribute in HTML5

The autocomplete Attribute in HTML5

 
The autocomplete attribute is used to provide help for the user during form entry by showing previously entered data in the drop-down list for re-entering data. The autocomplete attribute has two states, on and off. By default, its state is on for form. Now we use autocomplete attributes on our page. We write the following code:
  1. <!DOCTYPE HTML>  
  2. <html>  
  3.     <body>  
  4.         <form method="post" autocomplete="on">  
  5. First Name   
  6.             <input type="text" name="fname" />  
  7.             <br/>  
  8. Last Name   
  9.             <input type="text" name="lname" />  
  10.             <br/>  
  11. Account No.   
  12.             <input type="text" name="ac" autocomplete="off" />  
  13.             <br/>  
  14.             <input type="submit" />  
  15.         </form>  
  16.     </body>  
  17. </html>  
Now we run this code. The output will look like the below figure:
 
 autocomplete attribute

We do the entry for form and click on the submit button. We will note here that, when we do re-entry for First Name and Last Name then a drop-down list is displayed of previous input matched with the new input text. The autocomplete state if off for account number, so no previous Like as below:
 
autocomplete attribute
Next Recommended Reading Autocomplete In HTML5