</>
ValidateHTML

Invalid Attribute Value

Many HTML attributes are enumerated: they accept a fixed set of keywords and nothing else. target takes _blank, _self, _parent, _top or a browsing context name. loading takes lazy or eager. When the value is outside the list, the browser falls back to the default and says nothing, so the attribute looks applied while doing nothing.

Find this error in your own code. Paste your HTML or enter a URL, free and instant.Open the validator
29.9%
of sites tested

How common is this error?

We ran this validator over the home page of the Tranco top 5,000 websites in August 2026. 794 of the 2,655 sites we could reach hit it. That makes it the 7th most common HTML problem we found, across 12,568 occurrences. See the full study.

Most frequent wording: Attribute "target" has invalid value ""

Why It Matters

Present on 29% of sites, most often as an empty target="" left by a template that had no value to fill in. The failure is silent by design, which is what makes it worth a validator: nothing in the browser, the console, or the rendered page tells you the attribute was ignored.

Common Causes

  • Template interpolation that always prints the attribute, even when the variable is empty: target="{{ target }}".
  • Treating an enumerated attribute as a boolean, or a boolean as a string.
  • CMS fields that store an empty string rather than omitting the setting.

Code Examples

Invalid
<!-- Empty value: not a valid browsing context name -->
<a href="/docs" target="">Docs</a>

<!-- Case matters for some, not others; the list does not include "Lazy" -->
<img src="a.jpg" alt="A" loading="Lazy">

<!-- Not an enumerated value: this is a boolean attribute -->
<input type="checkbox" checked="true">
Valid
<a href="/docs">Docs</a>
<a href="/report.pdf" target="_blank" rel="noopener">Report</a>

<img src="a.jpg" alt="A" loading="lazy">

<input type="checkbox" checked>

How to Fix

  • 1Omit the attribute entirely rather than giving it an empty value. An absent target behaves as _self, which is what the empty string was trying to say.
  • 2For boolean attributes (checked, disabled, required, readonly), the presence of the attribute is the value. checked="false" is checked.
  • 3Guard templates so an attribute is only rendered when its value exists, instead of rendering an empty one.
  • 4Check the allowed list on MDN when an attribute seems to have no effect; a silently rejected value is the usual cause.

Frequently Asked Questions

Why does target="" get flagged when it works?
It works because the browser falls back to _self after rejecting the value, not because the value is accepted. The specification requires a valid browsing context name, and the empty string is not one. Removing the attribute produces the same behaviour and states the intent.
Are HTML attribute values case-sensitive?
Enumerated values are matched case-insensitively in HTML, so loading="LAZY" is accepted. It is still worth writing them lowercase: the same value in XHTML, in a framework prop, or in a strict parser may well not be.
What is a boolean attribute exactly?
One where presence means true and absence means false: disabled, checked, required, readonly, autofocus. Any value at all, including "false", still means true, which is why disabled="false" disables the control.

Check Your HTML Now

Our validator detects this error automatically and shows the exact line number.

Open HTML Validator

Related HTML Errors

← View all HTML errors