</>
ValidateHTML

Broken or Empty Links

Links with empty href attributes, href="#", or href="javascript:void(0)" are anti-patterns. Empty href causes the page to reload. Hash-only links jump to the top of the page. JavaScript void links break when JavaScript is disabled.

Why It Matters

Broken links frustrate users and waste crawl budget. Empty links create unexpected navigation behavior. Search engine crawlers follow every link — broken ones waste their time and can hurt your crawl efficiency.

Code Examples

❌ Invalid
<a href="">Click here</a>
<a href="#">Learn more</a>
<a href="javascript:void(0)">Submit</a>
✓ Valid
<a href="/pricing">View pricing</a>
<button type="button">Learn more</button>
<button type="submit">Submit</button>

How to Fix

  • 1Use <button> instead of <a> when the action doesn't navigate to a new page.
  • 2Always give links a real URL destination.
  • 3Use descriptive link text — "View pricing" not "Click here".
  • 4For anchor links, ensure the target ID exists: <a href="#features"> needs <div id="features">.

Check Your HTML Now

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

Open HTML Validator
Recommended

Hostinger Fast & Affordable Web Hosting

Deploy clean, validated HTML on reliable hosting.

Get 80% Off Hosting →

Related HTML Errors

← View all HTML errors