User2057738320 posted
a page if have scroll, a link have function, like below
<a href="#" onclick="alert('hello')">X</a>
if you click X, the pag will alert and the page will scroll to top.
if href keep blank, it will open new page.
<a href="" onclick="alert('hellow')">X</a>
so, want page keep position state, one method is return false.
<a href="#" onclick="alert('hellow'); return false">X</a>
if not use return false, use void(0) instead
<a href="javascript:void(0)" onclick="alert('hellow');">X</a>
someone also write :; like below.
<a href="javascript:;" onclick="alert('hellow');">X</a>
use ### can also have the keep position
<a href="###" onclick="alert('hellow');">X</a>
in fact, I often use
<a href="###" onclick="alert('hellow');">X</a> and <a href="#" onclick="alert('hellow'); return false">X</a>
a little difference is if add target=_blank ( <a target=_blank href="###" onclick="alert('hellow');">X</a>) the page will open new,
but, <a href="#" target=_blank onclick="alert('hellow'); return false">X</a> not.
now, my question is :
why <a href="##" onclick=alert("hello">X</a> DO NOT keep position state.
<a href="#" onclick=alert("hello")>X</a>
<a href="##" onclick=alert("hello">X</a>
<a href="###" onclick=alert("hello">X</a>