I have a menu selection that looks like this:
This solution assumes that the a
elements will only have a single class.
$('.menu li a').click(function (e) {
e.preventDefault();
$(".wrapper,.misc,.content,.about").hide(); // Hide all.
$("." + this.className.slice(0,-3)).show(); // Show one based on the class
});
It binds the same handler to all the a
elements.
When clicked, it hides all the targeted elements, and then slices away the "Nav"
from the .className
to create a selector to choose the one to display.
Not sure what .wrapper
does, since it's not in your HTML.