Forms & Inputs
Prev: Text & Lists | Up: elements | Next: Tables & Media
Rel: Form & Validation Attributes, Accessible Forms & Validation, Pseudo-Classes, Forms, Validation & Fetch
Ref: MDN Web Docs — HTML Elements
Tags: #public #web #html #elements #forms
Contents
Core Form Controls
Always associate every control with a <label> via matching for / id (or by wrapping the control) and set type="button" on non-submitting <button> elements inside a <form>.
<form method="post">
<fieldset>
<legend>Preferences</legend>
<label for="display-name">Display Name</label>
<input id="display-name" name="display_name" type="text" required />
<label for="plan">Plan</label>
<select id="plan" name="plan">
<option value="free">Free</option>
<option value="pro">Pro</option>
</select>
<button type="submit">Save</button>
</fieldset>
</form>
Grouping & Output Elements
<fieldset>+<legend>: Groups related inputs (especially radio button groups) with an accessible group label.<datalist>: Supplies native autocomplete suggestions for an<input list="...">.<output>: Displays calculated results associated with form inputs (for="a b").
Linked from
- tuts/html/attributes/form_and_validation_attributes
- tuts/html/elements
- tuts/html/elements/forms
- tuts/html/elements/forms/button
- tuts/html/elements/forms/datalist
- tuts/html/elements/forms/fieldset
- tuts/html/elements/forms/form
- tuts/html/elements/forms/input
- tuts/html/elements/forms/label
- tuts/html/elements/forms/output
- tuts/html/elements/forms/select
- tuts/html/elements/forms/textarea
- tuts/html/elements/forms_and_inputs
- tuts/html/elements/tables_and_media
- tuts/html/elements/text_and_lists
- tuts/html/tutorials/accessible_forms_and_validation
- tuts/web/security
Related notes
- tuts/html/attributes/form_and_validation_attributes Linked here; links to this page; shared tags: #forms, #html, #web
- tuts/html/elements Linked here; links to this page; shared tags: #elements, #html, #web
- tuts/html/elements/tables_and_media Linked here; links to this page; shared tags: #elements, #html, #web
- tuts/html/elements/text_and_lists Linked here; links to this page; shared tags: #elements, #html, #web
- tuts/html/tutorials/accessible_forms_and_validation Linked here; links to this page; shared tags: #forms, #html, #web
- tuts/html/elements/forms links to this page; shared tags: #elements, #forms, #html, #web
- tuts/html/elements/forms/button links to this page; shared tags: #elements, #forms, #html, #web
- tuts/html/elements/forms/datalist links to this page; shared tags: #elements, #forms, #html, #web
- tuts/html/elements/forms/fieldset links to this page; shared tags: #elements, #forms, #html, #web
- tuts/html/elements/forms/form links to this page; shared tags: #elements, #forms, #html, #web