I am trying to build a menu of items that expand when clicked but for some reason my .show() doesn't seem to be affect the DIV that I am trying to target - they just remain hidden. I set up a JSFiddle:
$(document).ready(function () {
$('.visa-class').click(function () {
$('.visa-class').toggleClass('open');
});
if ($('li>.visa-info').hasClass ('open')) {
$('.visa-info').show();
} else {
$('.visa-info').hide();
}
});
And after I can get them to all act together, I cannot figure out how to get them to act separately other than individually naming each of the sections - is this necessary?
You need to toggle the element on click itself:
Working Demo