I'm struggling to understand how to toggle a class based on the anchor text that is clicked.
<div>
<a id="Menu1" href="#">Menu</a>
<div id="subMenu1" class="subLevel">
<p>stuff</p>
</div>
<div>
<a id="Menu2" href="#">Menu</a>
<div id="subMenu2" class="subLevel">
<p>stuff</p>
</div>
<div>
<a id="Menu3" href="#">Menu</a>
<div id="subMenu3" class="subLevel">
<p>stuff</p>
</div>
<script>
$(document).ready(function () {
$("#Menu" + [i]).on('click', function (e) {
e.preventDefault();
$("#subMenu" + [i]).toggleClass('dropDownShow');
});
});
</script>
Struggling to pinpoint where the value of 'i' changes from 1 to 3 depending on which anchor link is clicked