I have 2 elements cols3 and cols4. If either one is hidden then by clicking a button that element is to be displayed.
But if both elements are hidden then by clicking a button only element col3 is to be displayed.
I tried with the following code :
but if both are hidden, by clicking the button both are displayed instead of only cols3.
Any help?
$('#plusexp').click(function() {
if ($('.cols3:visible')) {
if ($('.cols4:hidden')) {
$('.cols4').show();
}
}
if ($('.cols3:hidden')) {
$('.cols3').show();
}
});
Try this:
Example here: http://jsfiddle.net/jN7bc/