What is the best crossbrowser way to make anchor without href (javascript-driven) behave like real anchor? The most obvious one is to use # as anchor but it makes page jump...
+5
A:
A do-nothing link, that doesn't even jump:
<a href="javascript:void(0)">link</a>
mr.b
2010-05-22 00:30:55
+1
A:
These will not jump:
<a href="#null">Click</a>
<a href="#n">Click</a>
<a href="#undefined">Click</a>
They are, however, soul destroying and extremely ugly.
karim79
2010-05-22 00:36:02
+1
A:
If you're reacting to the click event, just make sure you return false and whatever is in the href, whether a #hash or other url, will be ignored.
<a href="#anything" onclick="doSomething(); return false;">link</a>
great_llama
2010-05-22 00:36:32