troubleshooting Question

image swap not working

Avatar of Brad Bansner
Brad Bansner asked on
jQueryJavaScript
7 Comments1 Solution341 ViewsLast Modified:
I have a bunch of images like this:

<img class="gr_mwc_dir" src="art/gr_mwc_dirclosed.png" width="9" height="9" border="0" />

All of my Javascript is attached, although I'm only concerned about the last part of it for this problem. Where I have $('.gr_mwc_dir').click that appears to not be working. I even put an alert in it, that function just isn't getting called at all when I click the image.

I must be doing something stupid, because this seems like it should be very simple! Thank you for looking!
<script type="text/javascript">

	$(function(){
		$('#gr_mwc_editworkoutsicons1').click(function(){
			alert('cardio');
		});
	});

	$(function(){
		$('#gr_mwc_editworkoutsicons2').click(function(){
			alert('strength');
		});
	});

	$(function(){
		$('#gr_mwc_editworkoutsicons3').click(function(){
			alert('flex');
		});
	});

	$(function(){
		$('#gr_mwc_editworkoutsicons4').click(function(){
			alert('balance');
		});
	});

	$(function(){
		$('#panelleft').load('https://www.myexerciserx.com/mfc_form_ep_desc3-leftpanel.asp?cur_day=5%2F16%2F2011', function(){
			$('#panelleft').fadeIn(400);
			$('#detailscreen').load('https://www.myexerciserx.com/mfc_form_ep_desc3-leftpanel2.asp?cur_day=5%2F16%2F2011');
		});
		$('#gr_mwc_arrowleft').click(function(){
			if ($('#displayscreens').offset().top==149) {
				$('#displayscreens').animate({top: '+=36px'}, 200);
				$('#displayscreens').animate({top: '-=36px'}, 200);
			} else {
				$('#displayscreens').animate({top: '+=414px'}, 800);
			}
		});
		$('#gr_mwc_arrowright').click(function(){
			if ($('#displayscreens').offset().top==-2335) {
				$('#displayscreens').animate({top: '-=36px'}, 200);
				$('#displayscreens').animate({top: '+=36px'}, 200);
			} else {
				$('#displayscreens').animate({top: '-=414px'}, 800);
			}
		});
		$("#gr_mwc_monthhead2").click(function(){
			$("#gr_mwc_monthhead2").attr("src", "https://www.myexerciserx.com/art/gr_mwc_monthhead2.png");
			$("#gr_mwc_monthhead3").attr("src", "https://www.myexerciserx.com/art/gr_mwc_monthhead3b.png");
			$("#detailscreen").fadeOut(400);
		});
		$("#gr_mwc_monthhead3").click(function(){
			$("#gr_mwc_monthhead2").attr("src", "https://www.myexerciserx.com/art/gr_mwc_monthhead2b.png");
			$("#gr_mwc_monthhead3").attr("src", "https://www.myexerciserx.com/art/gr_mwc_monthhead3.png");
			$("#detailscreen").fadeIn(400);
		});
		$('.dayblock').click(function(){
			$('.dayblockhl').removeClass('dayblockhl');
			$('.gr_mwc_monthblockarrowhl').removeClass('gr_mwc_monthblockarrowhl');
			$(this).addClass('dayblockhl');
			$(this).children('.gr_mwc_monthblockarrow').addClass('gr_mwc_monthblockarrowhl');
			$('#panelleft').fadeOut(200);
			$('#panelleft').load('https://www.myexerciserx.com/mfc_form_ep_desc3-leftpanel.asp?cur_day='+$(this).attr('id'), function(){
				$('#panelleft').fadeIn(400);
			});
		});
		$('.gr_mwc_dir').click(function(){
			if ($(this).attr('src')="https://www.myexerciserx.com/art/gr_mwc_dirclosed.png") {
				$(this).attr("src", "https://www.myexerciserx.com/art/gr_mwc_diropen.png");
			} else {
				$(this).attr("src", "https://www.myexerciserx.com/art/gr_mwc_dirclosed.png");
			}
		});
	});
</script>

Open in new window

ASKER CERTIFIED SOLUTION
dr_Pitter

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros