I am trying to add an image src into an image in div on click of a thumbnail. The problem is that the image src do not change when another thumnail is clicked.
HTML Code is:
<a class="thumbnail" href="#" >
<img src="img1">
<img src="img2">
<img src="img3">
</a>
<div class="imageforthumb">
<img class="imageforthumbs">
</div>
Javascript im using is:
$('.thumbnail').click(function () {
var images = $('.thumbnail img').attr('src');
$(".imageforthumbs").attr('src', images)
});
once i click the first image img1, it is set to img1 and do not change to img2 when i click the thumbnail. Please advice what could be wrong here ?