I have the following (simplified) HTML:
<div id="topMenu">
<div class="menu_wrapper">
<div class="logo">
</div>
<div class="responsive_menu" id="resp_Menu" onClick="fnResponsiveMenu()">
</div>
<div class="nav_wrapper">
<div class="navigation" id="navMenu">
<a href="Home.aspx">Contact Us</a>
</div>
<div class="navigation" id="navMenu">
<a href="Home.aspx">Information</a>
</div>
<div class="navigation" id="navMenu">
<a href="Home.aspx">Venue Details</a>
</div>
<div class="navigation" id="navMenu">
<a href="Home.aspx">Registration & Payment</a>
</div>
<div class="navigation" id="navMenu">
<a href="Home.aspx">Agenda</a>
</div>
<div class="navigation" id="navMenu">
<a href="Home.aspx">Home</a>
</div>
</div>
</div>
and the following CSS:
.navigation {
width:100%;
background-color:#3171B7;
border-bottom:1px solid #ffffff;
margin:0;
text-transform:uppercase;
font-size:16px;
height:40%;
padding-top:10px;
}
#navMenu{
display:none;
}
and the following JavaScript:
function fnResponsiveMenu()
{
var oNavMenu = document.getElementById('navMenu');
var oDisplay = oNavMenu.style.display;
if(oDisplay=="none")
{
oDisplay.style.display = "";
}
}
The problem is that the div with id="navMenu" is not being set to visible when I click.
From looking at the DOM explorer, I can see the element is set to display:none, but when calling the JavaScript function, the display is coming back as "".
I have searched the internet, but as far as I can see I am implementing everything correctly.
Is this something to do with the CSS? Do I have an obvious error that I cant see, or is there something missing in the functionality?
oDisplay.style.display = ""should beoNavMenu.style.display = ""I guess ?