HTML Dog
Skip to navigation

HTML Tag: select

Option selection form control, allowing a user to select one or more options from a list.

select contains option elements, which may also be grouped in optgroup elements.

Optional Attributes

Attribute Description Possible values
name Name of the form control, to be paired with its value. Text (no spaces).
disabled Disables the form control. None.
autofocus Indicates that the form control should have focus on page load. Should only be used on one form control in a page. None.
form Explicitly associates the control to a form element, which it may or may not be nested within. If absent, the control will be associated to its form ancestor. Text matching the value of a form element’s id attribute.
required Indicates that the form field must be completed. None.
multiple Indicates that the user can select more than one value. None.
size The number of options that a user should be expecting to see before making a selection. Default when used with multiple attribute is 4, otherwise default is 1. Number.
Global attributes

Example


<form action="dogselecta.php">
    <select name="dog">
        <option>Arctic Fox</option>
        <option>Maned Wolf</option>
        <option>Grey Wolf</option>
        <option>Red Fox</option>
        <option>Fennec</option>
        <option selected>Domestic Dog</option>
    </select>
    <input type="submit">
</form>