Re:Ask HN: Href=“#” VS href=“JavaScript:;”
by twobyfour on Thursday July 06, 2017 @06:21PM
(#14714425)
Neither, put a real URL in there so people can a) use your site without JS and b) open links in new tabs. Use e.preventDefault().
If you can't put a URL in it, use a different element. Why can't you use <button>? It's definitely the correct element for something that takes an action. In a pinch, fall back on <span>?
If you can't put a URL in it, use a different element. Why can't you use <button>? It's definitely the correct element for something that takes an action. In a pinch, fall back on <span>?