I know there are answers to this question all over, but none of them turned out to be satisfying for me.
Is there any official HTML5 way to handle clickable elements that do not have their hrefs?
What I always do is just this:
<a>Link</a>
They might have ID or classes of course, but it doesn't matter for an example. I make them clickable by scripts and don't put any href
in them. Some people find it incorrect.
Another options are:
<a href="#">Link</a>
<a href="javascript:void(0);">Link</a>
I hate this approach to be honest, because it makes href attribute containing a garbage.
Even another approach would be to use another tag:
<div>Link</div>
Is there any standarized way to do it? Or, perhaps, any way without proper href is incorrect, because as we all know, links actually should provide proper hrefs for non-js people.
EDIT
Okay, I see the answers are what I expected. To be clear, I know how to make it work and I'm looking for semantically correct way to do it. If you guys think that whatever passes HTML validation is good HTML, then you are wrong.