I need to check the status of the image in the img tag by using flag like imagestatus =1 in the following code
echo '<a href="#" class="swap-menu"><img id="menu_image" src="images/collapsed.gif" hspace = "2"/>'.$B->getAttribute('TITLE').'</a>';
here's the js file
$('.swap-menu').bind('click', function (event) {
$('.sub-menu').find("+ ul").slideUp(1);
$(this).find("+ ul").slideToggle("fast");
$(this).find("img").attr('src', 'images/expanded.gif');
});