Omit values of HTML boolean attributes
There are some HTML boolean attributes such as `checked`
, `disabled`
, `readonly`
, `required`
, `selected`
, etc.
According to the
HTML specification, a boolean attribute has three possible declarations. All of them have the same effect:
<input readonly />
<input readonly="" />
<input readonly="readonly" />
`true`
and `false`
are invalid values:
<button disabled="true">...</button>
<button disabled="false">...</button>
The only way to represent a `false`
value is to remove the attribute. Hence, to avoid the incorrect and misleading usages, it's recommended to remove the value:
See also