Skip to main content

HTML Guide

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

Use the boolean attribute disabled without any value or with the attribute name as the value; "true" is invalid.

Detailed explanation

The HTML boolean attribute disabled indicates that the element is not editable, focusable, or submittable. For boolean attributes (per the WHATWG HTML standard and MDN), the presence of the attribute means “on/true,” and its absence means “off/false.” Valid syntaxes are:

  • disabled
  • disabled=""
  • disabled="disabled"

Invalid values include arbitrary strings like "true" or "false". Using disabled="true" triggers the validator error because boolean attributes must not use non-empty values other than the attribute name itself.

Relevant elements that support disabled include input, button, select, textarea, optgroup, option, fieldset, and form (partial behavior). For dynamic enabling/disabling, set or remove the attribute via JavaScript rather than assigning string values.

HTML examples

Reproduce the validator error (invalid)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Invalid Disabled Example</title>
</head>
<body>
  <form>
    <input type="text" disabled="true">
    <button type="submit" disabled="false">Submit</button>
  </form>
</body>
</html>

Fix (valid boolean attribute usage)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Valid Disabled Example</title>
</head>
<body>
  <form>
<!-- Presence means disabled -->

    <input type="text" disabled>
<!-- Also valid: disabled="disabled" or disabled="" -->

    <button type="submit" disabled="disabled">Submit</button>
  </form>
</body>
</html>

Learn more:

Related W3C validator issues