Sorry If this is simple but I need some help with my navigation bar. I can’t seem to be able to toggle to show/hide the div with the click of a link. My code is here. This is just some a basic format as I want the right functionality before adding it to my website. Thanks!
<html>
<head>
<link rel="stylesheet" type="text/css">
<style>
#submenu ul{
display:none;
}
</style>
<script type="text/javascript">
function showDiv() {
document.getElementById('submenu').style.display = "block";
}
</script>
</head>
<body>
<div id="navigation">
<ul>
<li id="submenu" onclick="showDiv()";><a href="#"> Hi</a>
<ul>
<li><a href="#"> Hi2</a>
</ul>
</li>
</ul>
</div>
</body>
</html>
So in this example I want the hidden div to show Hi2 once I click Hi1. I don’t mind using JQuery or Javascript I just need a way around this. I’ve made other navigation menus’s however they were horizontal and usually worked by hover menus. Appreciate any help!
Use this
DEMO
If you dont want to toggle then use
DEMO 2