The HTML autocomplete
attribute lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.
It is available on <input>
elements that take a text or numeric value as input, <textarea>
elements, <select>
elements, and <form>
elements.
And also,the HTML autocomplete
attribute provides a wide variety of options for <input>
fields. One of these is the new-password
value, which can be used when the user is asked to create a new password (e.g. register or reset password forms). This value ensures that the browser will not accidentally fill in an existing password, while it also allows the browser to suggest a secure password:
HTML
<form action="register" method="post">
<input type="text" autocomplete="username">
<input type="password" autocomplete="new-password">
<input type="submit" value="Register">
</form>
Additionally, autocomplete="new-password"
should be used for both password fields if the form has a second password field that asks the user to retype the newly constructed password.
Top comments (0)