HTML Attributes

HTML selected attribute

Build a form with the HTML form generator

Sets an option's default selected state. The current selected property may change independently after interaction. A single-select should have only one default selected option. Applicable elements include: <option>. Check each element’s value rules. Boolean syntax: presence enables the state; omit the attribute to disable it. A string value of "false" does not turn it off.

Formal Syntax & Structure

html syntaxhtml
selected

Parameters & Attributes

NameTypeDescription
selectedbooleanSets an option's default selected state. The current selected property may change independently after interaction. A single-select should have only one default selected option.

Working Example

Example Snippethtml
<label>  Size  <select>    <option>Small</option>    <option selected>Medium</option>  </select></label>
HTML Reference