I have a menu that contains 3 items. How can I change that the text to what it's selected from the menu?
HTML
<div id="dropdown-container">
<div id="index-tab" onclick="toggleMenu()"><a href="#">1</a></div>
<ul id="dropdown">
<li ><a href="#"><span class="current-browse">1</span></a>
<ul class="dropdown-items">
<li class="dropdown-item"><a href="#">2</a></li>
<li class="dropdown-item""><a href="#">3</a></li>
</ul>
</li>
</ul>
</div>
JavaScript
function toggleMenu() {
var dropDown = document.getElementById('dropdown');
if(dropdown.style.display == "block") {
dropdown.style.display = "none";
} else {
dropdown.style.display = "block";
}
}
For example the menu currently showing:
1
1
2
3
If selected 2, it will show:
2
2
1
3
If selected 3 it will show :
3
3
1
2