我正在考虑处理单击事件的最佳解决方案,以避免更改浏览器中的位置(#)。
这是两种情况:
1. <a class="someclass" href="#">Click me</a>
(This is ok, but adds a "#" in the url)
2. <a class="someclass" href="javascript:void(0)">Click me</a>
(Seems to be better, the url never changes, but I don't know about compatibility in all browsers, or even when javascript is disabled)
哪一个是最好的解决方案?