I have this bit of code that adds an image to the 'imageContainer'
$('.imageContainer').prepend('<img id="xboxLogo" src="images/xboxLogo.png"/>')
I have this array of objects :
var imagesArray = {
xboxLogo : {
id : 'xboxLogo';
src: "images/xboxLogo.png";
},
playStatLogo : {
id : 'playStatLogo';
src: "images/playStatLogo.png";
},
wiiLogo : {
id : 'wiiLogo';
src: "images/wiiLogo.png";
}
}
What I want to do is have a function that I call which adds the image to the 'imageContainer' but I want the image to be randomly picked from the 'imagesArray'. How do i randomly get one of the 3 (xbox,playStation,wii) images and then retrieve their attributes so I can use them to create the images ?