oldoc63 / learningHTML

Learning HTML with Codecademy and GitHub
0 stars 0 forks source link

Dropdown list is a must! #16

Closed oldoc63 closed 3 years ago

oldoc63 commented 3 years ago

Radio buttons are great if we want our users to pick one option out of a few visible options, but imagine if we have a whole list of options! This situation could quickly lead to a lot of radio buttons to keep track of. An alternative will be something like this:

<form>
  <label for="lunch">What's for lunch?</label>
  <select id="lunch" name="lunch">
    <option value="pizza">Pizza</option>
    <option value="curry">Curry</option>
    <option value="salad">Salad</option>
    <option value="ramen">Ramen</option>
    <option value="tacos">Tacos</option>
  </select>
</form>
oldoc63 commented 3 years ago

Notice in the code that we’re using the element and the value of the chosen