Reputation: 8443
What is the difference between javascript://
and javascript:void(0)
?
<a href="javascript://" class="button toggle-filters">Filters</a>
Upvotes: 3
Views: 777
Reputation: 8830
Previous two answers cover the direct answer to your question, but on a separate track I think you should consider using neither of them. Assuming you're using the anchor tag to illustrate to the user that there's an action they can take by clicking on that text, there are multiple mechanisms for illustrating that, and semantically an anchor tag should illustrate a destination, not an activity.
See this previous answer, and this one.
Upvotes: 2
Reputation: 7249
javascript://
runs JavaScript that has no statements
javascript:void(0)
runs JavaScript that evaluates the statement 0
and then returns undefined
.
so javascript://
is much similar to javascript:;
Upvotes: 2