HTML Forms: Total Domination
Sobre a Aula

The <input type="checkbox"> creates a checkbox in HTML forms. Unlike radio buttons that allow only a single exclusive choice, checkboxes enable users to select multiple options from a predefined set.

This is similar to checking items off a to-do list, where you can choose several options simultaneously.

Consider a notification preferences form, where the user can choose to receive updates via email, text messages, or both.

Using checkboxes in this context allows the user to indicate their specific preferences flexibly.

Checkboxes are a valuable tool when it’s necessary to let users choose multiple options from a limited set, providing a more personalized approach to data collection.

By incorporating this type of input in forms, developers empower users to indicate their preferences in a more detailed manner, contributing to a more tailored and satisfying user experience.

See the example:

<form>
  <input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
  <label for="vehicle1"> I have a bike</label><br>
  <input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
  <label for="vehicle2"> I have a car</label><br>
  <input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
  <label for="vehicle3"> I have a boat</label>
</form>
Entrar na conversa
Rolar para cima