Friday, September 2, 2011

Disable Auto-complete Feature of HTML Form in Web Page


Hello everyone. In this tutorial, I will show you how you can disable auto-complete feature in HTML form. Sometimes, you look to disable this feature for forms that contain very sensitive information relative to the user.

Now, if you start filling the below form, you might notice that it provides you with auto-complete feature because it's enabled. This auto-complete feature is enabled in the form by default. If the form doesn't complete for you, try submitting once in the below form.

First name:

Last name:


The full HTML code snippet for the above form is the following.
<form action="#">
<p>First name: <input type="text" name="fname" value="" /></p>
<p>Last name:<input type="text" name="lname" value="" /><p>
<input type="submit" value="Submit" />
</form>

If you want to disable the auto-complete feature in any form, simply you need to add the the attribute autocomplete = "off". Note that we set the value for the attribute autocomplete to off

First name:

Last name:


The full HTML code snippet for the above form is the following.
<form action="#" autocomplete="off">
<p>First name: <input type="text" name="fname" value="" /></p>
<p>Last name:<input type="text" name="lname" value="" /><p>
<input type="submit" value="Submit" />
</form>

Hope you learned something new from this tutorial.

No comments:

Post a Comment