Valid to use (anchor tag) without href attribute?

I’ve been using Twitter Bootstrap to build a site, and a lot of its functionality depends on wrapping things in <a>, even if they’re just going to execute Javascript. I’ve had problems with the href="#" tactic that Bootstrap’s documentation recommends, so I was trying to find a different solution.

But then I tried just removing the href attribute altogether. I’ve been using <a class="bunch of classes" data-whatever="data">, and having Javascript handle the rest. And it works.

Yet something’s telling me I shouldn’t be doing this. Right? I mean, technically <a> is supposed to be a link to something, but I’m not entirely sure why this is a problem. Or is it?

5 Answers
5

Leave a Comment