I have a div with some images, and when I clicked on those images I want another div to open with that Image that I clicked.
JS
$(\'
change line 3 to reference the image instead of its container:
$('#image-zoom img').attr("src",loc);
#image-zoom is an id for a div tag, which doesn't have a src attribute. So in order to change the image you've to traverse to img:
$('#image-zoom img').attr("src",loc);
Change the src of the image, not of the div:
$('#image-zoom img').attr("src",loc);