HTML – Basic Forms
An HTML form is used to collect user input and send to a server for processing.
To expand on theĀ basic HTML form, we can addĀ text inputs, textarea inputs, checkboxes, and radio buttonsĀ to gather user information to be sent to a server for processing.
The <fieldset> tag is used to group related elements in a form for easier viewing by providing a box around the related elements.
TheĀ <form>Ā tag is used to create a form for a user to send information to the site owner. A form can containĀ textfields, checkboxes, radio-buttons, and more.
TheĀ <input>Ā tag specifies an input field where the user can enter data in a form to send to the site owner.
TheĀ <label>Ā tag defines a label forĀ form input fieldsĀ to give the user an indication of what is expected from each user input.
TheĀ <optgroup>Ā tag is used to group related options in aĀ <select>Ā elementĀ (drop-down list), which makes things easier to see for the user.
TheĀ <option>Ā tag defines an option in aĀ <select>Ā element,Ā <optgroup>Ā element, orĀ <datalist>Ā element.
TheĀ <select>Ā tag is used to create a drop-down list, and is most often used in a form to collect user input.
TheĀ <textarea>Ā tag defines a multi-line text input element often used in a form to collect user inputs like comments or reviews.
The fieldset tag is used to group related elements in a form for easier viewing by providing a box around the related elements. These are its attributes.
The form tag defines an HTML form. There are multiple attributes that can be applied to the form tag.
The input tag specifies an input field where the user can enter data in a form to send to the site owner. These are its attributes.
The label tag defines a label for form input fields and requires these two attributes to connect the label with its respective input.
The option tag defines an option in a select element, optgroup element, or datalist element. These are the attributes for the option tag.
The optgroup tag is used to group related options in a select element (drop-down list). These are the attributes used in an optgroup element.
The select tag is used to create a drop-down list, and is most often used in a form to collect user input. These are the attributes for the select tag.
The textarea tag defines a multi-line text input element often used in a form. These are the attributes used in a textarea tag.
The onblur event fires when a form field loses focus, and is often used with form validation. The onblur event is the opposite of theĀ onfocus event.