Show/Hide Problem
Show/Hide Problem
Hi,
I put together the following snippet, but it doesn't work quite right. I'm trying to allow the user to click an image on the page and show some HTML that was originally hidden. Basically a typical expand/collapse thing...
The user clicks an image on my page and the below code runs:
// if it's NOT visible
if(!$('.row').is(':visible') ) {
$('#imgButton').attr("src","images/icon_minus.gif");
$('.row').show();
}
else {
$('#imgButton').attr("src","images/icon_plus.gif");
$('.row').hide();
}
The problem is the row is initially hidden, but when the show() is called, now's its visible, so the else statement seems to run right after and hide my HTML again.
Any help appreciated
-ws