|
|
|
Ask HN: Href=“#” VS href=“JavaScript:;”
|
|
2 points
by optikals
3273 days ago
|
|
Sorry for my silly question, can you tell me if there's a difference between href="#!" and href="javascript:;" and which one it's better to use on the links with JavaScript attached to them (nothing else, JS only). I know it's not the correct use, it should be a "button", but I really need to use <a>. Thank you. |
|
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>?