View Single Post
Old 11-27-2011, 02:51 AM   PM User | #1
Paramasivan
New Coder

 
Join Date: May 2011
Posts: 20
Thanks: 5
Thanked 1 Time in 1 Post
Paramasivan is an unknown quantity at this point
jQuery hide / show elements

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 :

$('#plusexp')
.click(function() {
if ($('.cols3:visible')) {
if ($('.cols4:hidden')) {
$('.cols4').show();
}
}
else if ($('.cols4:visible')) {
if ($('.cols3:hidden')) {
$('.cols3').show();
}
}

$('.cols3').show();

});

but if both are hidden, by clicking the button both are displayed instead of only cols3.

Any help?
Paramasivan is offline   Reply With Quote