About This HTML Issue
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
<select name="color">
<option value="red">Red</option>
<option value="blue" selected="1">Blue</option>
<option value="green">Green</option>
</select>
Valid Example
<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.
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.
Help us improve our guides
Was this guide helpful?
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries