# Bad value “1” for attribute “selected” on element “option”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-1-for-attribute-selected-on-element-option
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `selected` attribute on the `<option>` element is a boolean attribute and does not accept a value like `"1"`.

Boolean attributes in HTML don't need a value at all. Their mere presence on an element means "true," and their absence means "false." When you write `selected="1"`, the W3C validator flags it because `"1"` is not a valid value for a boolean attribute.

According to the HTML specification, a boolean attribute can only have three valid forms: the attribute name alone (`selected`), an empty string (`selected=""`), or the attribute's own name as the value (`selected="selected"`). Any other value, including `"1"`, `"true"`, or `"yes"`, is invalid.

## Invalid Example

```html
<select name="color">
  <option value="red">Red</option>
  <option value="blue" selected="1">Blue</option>
  <option value="green">Green</option>
</select>
```

## Valid Example

```html
<select name="color">
  <option value="red">Red</option>
  <option value="blue" selected>Blue</option>
  <option value="green">Green</option>
</select>
```

Using just `selected` without a value is the cleanest and most common approach.
