I have a list with 8 thumbnails images. When I click in one of them the bigger image gets the source of the that thumbnail. I can do this one by one.
$('#img_1').click(function(){
var temp = $('#img_1').attr('src');
$('#bigger_image').attr('src', temp);
});
I tried to use a for loop but I always get the last thumbnail source
for(var i=0; i<$('#thumbsContainer').children().length;i++){
$('#img_'+i).click(function(){
var temp = $('#img_'+i).attr('src');
$('#bigger_image').attr('src', temp);
});
}
How should I do it in a once?
Try this