The autocomplete
attribute and disabled
attribute are attributes frequently used for forms. The autocomplete
attribute is used for setting the autocomplete functionality. The disabled
attribute is used for disabling user input for the form component.
The default value of the autocomplete
attribute is "on"
. If you don't want to have the autocomplete functionality for a specific form, add autocomplete="off"
in the <input>
tag.
You may want to prevent a user from submitting a form until the user completes all actions required. Or, you may want to prohibit a user to select one of the listed options. For these cases, you can use the disabled
attribute. To implement this, what you need to do is just add the "disabled"
keyword in the tags you want to disable.
</body>
tag and adjust the code:
autocomplete="off"
in the <input>
tags, anddisabled
in the <textarea>
and <button>
tags.
<h3>5. Auto Complete and Disabled</h3>
<form>
<input type="text" placeholder="username" name="username" autocomplete="off">
<input type="email" placeholder="email" name="email" autocomplete="off">
<textarea placeholder="comment" name="comment" disabled></textarea>
<button type="submit" disabled>Send</button>
</form>
After editing the file, make sure that you save it (⌘ + S for Mac, Ctrl + S for Windows).
You can also check the sample result here (Demo Site ).
The autocomplete
attribute and disabled
attribute are attributes frequently used for forms. The autocomplete
attribute is used for setting the autocomplete functionality. The disabled
attribute is used for disabling user input for the form component.
The default value of the autocomplete
attribute is "on"
. If you don't want to have the autocomplete functionality for a specific form, add autocomplete="off"
in the <input>
tag.
You may want to prevent a user from submitting a form until the user completes all actions required. Or, you may want to prohibit a user to select one of the listed options. For these cases, you can use the disabled
attribute. To implement this, what you need to do is just add the "disabled"
keyword in the tags you want to disable.
</body>
tag and adjust the code:
autocomplete="off"
in the <input>
tags, anddisabled
in the <textarea>
and <button>
tags.
<h3>5. Auto Complete and Disabled</h3>
<form>
<input type="text" placeholder="username" name="username" autocomplete="off">
<input type="email" placeholder="email" name="email" autocomplete="off">
<textarea placeholder="comment" name="comment" disabled></textarea>
<button type="submit" disabled>Send</button>
</form>
After editing the file, make sure that you save it (⌘ + S for Mac, Ctrl + S for Windows).
You can also check the sample result here (Demo Site ).