CA Resources

Select and Option

The select element creates a dropdown menu, and option elements define the available choices.

select

The <select></select> element defines a drop-down list.

option

The <option></option> element defines an option that can be selected.

selected

Use the selected attribute to the <option> element to define a pre-selected option.

<form>
  <label for="civilstat">Civil Status:</label>
  <select id="civilstat" name="civilstat">
    <option value="single" selected>Single</option>
    <option value="married">Married</option>
    <option value="separated">Separated</option>
    <option value="widowed">Widowed</option>
  </select>
</form>

On this page

Edit on GitHub