Friday, 30 December 2011

HTML5- Autocomplete Form Attribute

Autocomplete Form Attribute

The autocomplete attribute specifies that the form or input field should have an autocomplete function.
Note: The autocomplete attribute works with <form>, and the following <input> types: text, search, url, telephone, email, password, datepickers, range, and color.
When the user starts to type in an autocomplete field, the browser should display options to fill in the field:

Syntax

<form action="demo_form.asp" method="get" autocomplete="on">
UserName: <input type="text" name="UserName" /><br />
Password: <input type="text" name="Password" /><br />
E-mail: <input type="email" name="email" autocomplete="off" /><br />
<input type="submit" />
</form> 
 

Example

<!DOCTYPE html>
<html>
<body>

<form action="demo_form.asp" method="get" autocomplete="on">
UserName:<input type="text" name="UserName" /><br />
Password:<input type="text" name="Password" /><br />
  E-mail: <input type="email" name="email" /><br />
  <input type="submit" />
</form>

<p>Fill in and submit the form, then reload the page, start to fill in the form again - and see how autocomplete works.</p>
<p>Then, try to set autocomplete to "off".</p>

</body>
</html>

 

No comments:

Post a Comment