Avoid the void(0) in IE6

I recently learned the hard way that <a href="javascript:void(0)"> doesn’t work as expected in IE6. The solution is to use the familiar # but make sure your onclick event returns false:

<a href="#" onclick="aFunction();return false;">Link</a>

d’bug has a great writeup on why this works and the other doesn’t.

Written on April 7, 2010