I have put together a basic menu for my WordPress site without relying on classes or IDs:
<div class="main-menu">
<nav>
<ul>
<li>
<a href="#" class="menu-link">home</a>
</li>
<li>
<a href="#" class="menu-link">product</a>
<ul>
<li>
<a href="#">XXXX</a>
</li>
<li>
<a href="#">XXXX</a>
</li>
<li>
<a href="#">ZZZZ</a>
<ul>
<li>
<a href="#">XXXX</a>
</li>
<li>
<a href="#">XXXX</a>
</li>
<li>
<a href="#">XXXX</a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#" class="menu-link">more</a>
</li>
</ul>
</nav>
</div>
I then used this CSS to hide the sub-menu:
.main-menu ul li ul {
display: none;
}
Previously, I had a script that showed the mini menu when the menu was clicked:
$('.menu').click(function(evt) {
evt.preventDefault();
$(".mini_menu").show();
});
Now, I am in need of a new script that will show the sub-menu when any of the li's is clicked.