This is a "Crystals Collector" game which creates four crystals ("divs") with random numbers inside them, which the user clicks to add numbers to a random number the computer has generated, to match the computer's random number. Everything works but I'm having a hard time adding the images of crystals I need into the 4 divs.
var image = "../../assets/images/crystal.jpg"
var crystal = $("<div>");
crystal.attr({
"class": 'crystal',
"data-random": randomNum,
"src": image
});
$(".crystals").append(crystal);
The only result I need is for 4 crystal images to show in my 4 divs created for the random number clicks.
imgtag, set it's src to the image url and then append it to thecrystals.<div>. Create animginstead:var crystal = $("<img/>");<divs>to store the random numbers within. Basically, I need 4<divs>to store both random numbers AND images within.