I am trying to replace the src in my img with the value in my hidden field and it does nothing. I am displaying products and have to change the src value to match the current product displayed.
Here is the javascript I am using in the html header:
var img = new Image();
$(img).load( function () {
$('#prdimg').attr('src', img.src);
});
img.src = $('#imgpath').val();
Here are the div elements I am using in html:
<div id='divDetail' >
<input id="imgpath" name="imgpath" type="hidden" />
<img id="prdimg" name="prdimg"
src="http://s3.amazonaws.com/images.eprevue.net/p4dbimg/767/image120/79100.jpg"/>
Here are the values in developer tools when I run it:
<input id="imgpath" name="imgpath" type="hidden" value="http://s3.amazonaws.com/images.eprevue.net/p4dbimg/767/image120/680235.jpg ">
<img id="prdimg" name="prdimg" src="http://s3.amazonaws.com/images.eprevue.net/p4dbimg/767/image120/79100.jpg">
I want to show the 680235 image.
Thanks for any help.