Easy Tutorial
❮ Tag Address Att Button Autofocus ❯

HTML <option> selected Attribute

HTML <option> Tag

Example

A drop-down list with a pre-selected option:


Browser Support

All major browsers support the selected attribute.


Definition and Usage

The selected attribute is a boolean attribute.

The selected attribute specifies that the option should be pre-selected when the page loads.

The pre-selected option will be displayed at the top of the drop-down list.

Tip: The selected attribute can also be set after the page loads, using JavaScript.


Differences Between HTML 4.01 and HTML5

None.


Differences Between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the selected attribute must be defined as <option selected="selected">.


Syntax


❮ Tag Address Att Button Autofocus ❯