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
<a href="">Click here</a> <a href="#">Learn more</a> <a href="javascript:void(0)">Submit</a>
<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 ValidatorHostinger — Fast & Affordable Web Hosting
Deploy clean, validated HTML on reliable hosting.
Related HTML Errors
Missing Alt Attribute on Images
Learn why every img element needs an alt attribute and how to write good alt text for accessibility and SEO.
Empty Heading Tags
Why empty h1, h2, h3 headings hurt SEO and accessibility. How to fix or remove empty heading elements.
Duplicate ID Attributes
Why duplicate IDs break JavaScript and accessibility. Learn how to find and fix duplicate id attributes in your HTML.