Disappearing text in IE6 and "dead" JavaScript links
Saturday, December 1st, 2007 at 1:31 am
We discovered a couple little annoyances with IE6, and I thought it would be useful to publish their workarounds.
Issue #1:
Random text would "disappear" on a page. It actually was still there and would show sometimes after hovering over it. The fix turns out to be setting the CSS for the text in question to "height: 0.01%" - it's so simple but so needless. It shouldn't have to be done. It should just work.
Issue #2:
<a href="javascript:anything" onclick="something()">
Won't work. It will just act like a dead link (or perhaps just ignore the onclick...) This will work however:
<a href="javascript:something()>
Note: Typically I try to keep my href's to be plain "javascript:;" if I need to use anchor-based links, and then chain events off of it using the element's ID and jQuery.
This entry was posted and is filed under Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Comment on this post:
2 Responses to "Disappearing text in IE6 and "dead" JavaScript links"
I think the correct syntax for empty javascript links is javascript:void(0). I'm unable to find the documentation right now, but it seems that in javascript syntax that's the way for a function returning null.
In the past I swore void(0) makes other actions tied to that link not execute. I'm too lazy to try it now
But for some reason I have it in my head to not use void. Or maybe, it was void(), and void(0) is okay? Oh well.
I have not had any issues with "javascript:;" as of yet though. Perhaps the next time I need to write some code like that I will try void(0) - but I haven't coded any pseudo-dead links like that recently.