change img src with jQuery

I don't understand why I can't chnage the image by chaning the src. What am I doing wrong?

<td id="TagLine" colspan="2" align="right"><?php echo '<img id="DoYouMeasureUp" src="'.BASEURL .$taglinefile .'" alt="'.$_SESSION['lang']['tagline'] .'" width="296" height="44"/>'?>

Open in new window

I added this in a jQuery and tried all three different ways to define path to file
	$("#sLangSelect").live('change', function(){
		var myLanguage = $(this).val();
		switch (myLanguage)
			case '1':
				$('img').attr('src') = '/images/do-you-measure-up-english.gif';
			case '2':
				$('#DoYouMeasureUp').attr('src')= "images/do-you-measure-up-french.gif";
			case '3':
				$('#DoYouMeasureUp').attr('src')= "";
	/*	var rt = $.ajax({
	   type: "POST",
	   url: "/aaMain/header.php?ulang="+$(this).val(),
	   //data: $("form[name=filters]").serialize(),
	   success: function(msg){
$("#headerSection").html(msg); }


Open in new window

Who is Participating?
leakim971Connect With a Mentor PluritechnicianCommented:
with select the image by its id and not it tag, use the # :

('#imgId').attr('src', '/images/do-you-measure-up-english.gif');

Open in new window

For example :

$('img').attr('src', '/images/do-you-measure-up-english.gif');

Open in new window

and not :

$('img').attr('src') = '/images/do-you-measure-up-english.gif';

Open in new window

gbeaulacAuthor Commented:
You are the Man!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.