tags:

views:

44

answers:

2

I'm having trouble showing and hiding a tag on my page.

When the page loads I have

<a id="mylink" class="hiddenClass">...</a>

hiddenClass has display: none

When a certain event occurs, I use javascript to try and show the element in block style

document.getElementById("mylink").display = "block";

It doesn't show it. When I alert document.getElementById("mylink").display it says block.. but it's not showing.

How can I fix this..? And, in general, what is the best way to show and hide DOM elements?

A: 

You could remove that class

document.getElementById("mylink").className = '';
alex
+6  A: 

You need to do:

document.getElementById("mylink").style.display = "block";
Eric
Ah, simple! Thanks much
babonk