Anchors using `javascript:void(0)` or `javascript:;` suppress navigation but cause accessibility and SEO issues.
By Seoxpert Editorial · Published
Using `javascript:void(0)` in anchor tags is an outdated workaround that creates accessibility, usability, and security problems. It can break keyboard navigation, confuse screen readers, and violate Content-Security-Policy rules, negatively affecting both user experience and SEO.
Leaving this unresolved can harm accessibility, break functionality for some users, and reduce SEO effectiveness.
Automated crawlers scan for anchor (`<a>`) tags with `href` attributes set to `javascript:void(0)` or `javascript:;`.
Problem: Anchor using javascript:void(0)
<a href="javascript:void(0)" onclick="doSomething()">Click me</a>Solution: Button styled as link
<button type="button" onclick="doSomething()" class="link-button">Click me</button>
<style>
.link-button {
background: none;
border: none;
color: #06c;
text-decoration: underline;
cursor: pointer;
}
</style>It causes accessibility, usability, and security issues, and is not the semantically correct way to trigger actions.
Yes, if the element is meant to trigger an action and not navigate, use a `<button>` instead and style it as needed.
It improves accessibility and semantics, which can positively impact SEO by making your site more usable and crawlable.
Use CSS to style the button to look like a link while keeping the correct semantics.
Run a scan to see if Anchors Using `javascript:void(0)` or `javascript:;` affects your pages.
Scan my website →