Shelby Shelby - 1 year ago 231
jQuery Question

Adding an anchor tag to list items making the list items disappear?

This is my first question on here, so apologies if it isn't worded correctly.
I'm trying to make a popup mobile navigation menu with jQuery, but when I add anchor tags to my list items, they disappear. Here's the HTML:

<button id="nav-open">&#9776;</button>
<div id="menu">
<button id="nav-close"> X </button>
<li><a href="">Home</a></li>

Here is the JS:



When a user clicks on #nav-open on a mobile device, it brings up the popup menu. (And when #nav-close is clicked, vice-versa.) I'm trying to add anchor tags to the list items but for whatever reason when I
add links to #menu's li's, the text disappears completely.

Any ideas on how to fix this?

Here is the CSS:

#menu {
background: #000;
opacity: 0.95;
font-family: Arial Narrow;
text-transform: uppercase;
text-align: left;
font-weight: bold;
font-size: 30px;
margin-right: 5%;
height: 60px;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 260px;
padding-bottom: 10px;

Answer Source

Your problem isn't with any of the code you posted- it's in the CSS. You have this style declared:

nav a {
   visibility: hidden;

Not sure why you have it, but that's definitely the cause. Simply deleting this will solve your issue.

Update: The CSS is in this file:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download