Skip to main content

HTML Guide

Bad value “true” for attribute “checked” on element “input”.

checked is a boolean attribute and should not have a value; it must be written as just checked.

The checked attribute is used with <input> elements of type checkbox or radio. As a boolean attribute, it is either present (interpreted as true) or omitted (false). Adding any value, like checked="true", is not valid and causes a validation error. The correct usage is simply checked, not checked="true" or checked="checked".

Incorrect example:

<input type="checkbox" checked="true">

Correct example:

<input type="checkbox" checked>

Example in context:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Checkbox Example</title>
</head>
<body>
  <label>
    <input type="checkbox" checked>
    Subscribe to newsletter
  </label>
</body>
</html>

Learn more:

Related W3C validator issues