im trying to create 2 divs that will contain a few images, the same images (2 logos strips that looks the same) - all dynamically.
this is my code:
//those are my vars
var logos = ['logo1','logo2','logo3'];
var $stripLogo; //will use later to create the images
var $stripContainerA = $('<div>', {class: 'stripContainer', id: 'stripA'}); //Container 1
var $stripContainerB = $('<div>', {class: 'stripContainer', id: 'stripB'}); //Container 2
//and this is how i append it
$('#logosStrip').append($stripContainerA); //Insert container 1 into an existing element
$('#logosStrip').append($stripContainerB); //Insert container 2 into an existing element
for(var i = 0; i < logos.length; i++) {
$stripLogo = $('<img/>', {class: 'stripLogo', src: 'img/logos/' + logos[i] }); //Create an image
$stripContainerA.append($stripLogo); //append image to container 1
$stripContainerB.append($stripLogo); //append image to container 2
}
the thing is, it seems like it can only append the img to 1 container, and not both. what is wrong with the code?
i hope its clear enought