Trying to solve this problem:
I have the following set of divs that when clicked show a particular panel. I can do this by hard coding the values, but was wondering how to go about this in the most efficient way.
<div id="myContainer">
<div id="myMenu_1" class="myMenu">Menu1</div>
<div id="myMenu_2" class="myMenu">Menu2</div>
<div id="myMenu_3" class="myMenu">Menu3</div>
</div>
<div id="myPanel_1" class="myPanel">If Menu1 is clicked show this panel</div>
<div id="myPanel_2" class="myPanel">If Menu2 is clicked show this panel</div>
<div id="myPanel_3" class="myPanel">If Menu3 is clicked show this panel</div>
As noted above, I know how to do this by
$('myMenu_1').click(function(){$('myPanel_3').hide();$('myPanel_2').hide();$('myPanel_1').show();});
But this doesn't seem very efficient if I have to do it for multiple items.