Skip to main content
HTML Validation

Bad value “true” for attribute “defer” on element “script”.

About This HTML Issue

The defer attribute on the <script> element is a boolean attribute and should not be assigned a value like "true".

In HTML, boolean attributes don’t work like regular attributes. A boolean attribute is considered “true” simply by being present on the element, and “false” by being omitted entirely. Setting defer="true" is invalid because the only allowed values for a boolean attribute are either the empty string ("") or the attribute’s own name (e.g., defer="defer").

The defer attribute tells the browser to download the script in parallel with HTML parsing and execute it only after the document has been fully parsed. It only works on scripts with a src attribute — it has no effect on inline scripts.

Bad Example

<script src="app.js" defer="true"></script>

Good Example

<script src="app.js" defer></script>

This rule applies to all boolean attributes in HTML, such as disabled, checked, readonly, async, hidden, and others. Just include the attribute name by itself — no value needed.

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?
🌍 Trusted by teams worldwide

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.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries