html - Add images in array to div element jQuery -
hello i'am trying add images of array existing div tag using jquery. every time try following error : "syntaxerror: unexpected string literal "'/>". expected ')' end argument list." can me this?
</div> <script> var pictures = new array(7); var counter = 0; $(document).ready(function() { // sets array startin values pictures[0] = new image(100, 100); pictures[0].src = "../spel in jquery/img/bubbles/blue.png"; pictures[1] = new image(50, 50); pictures[1].src = "../spel in jquery/img/bubbles/green.png"; pictures[2] = new image(50, 50); pictures[2].src = "../spel in jquery/img/bubbles/red.png"; pictures[3] = new image(50, 50); pictures[3].src = "../spel in jquery/img/bubbles/yellow.png"; pictures[4] = new image(50, 50); pictures[4].src = "../spel in jquery/img/bubbles/orange.png"; pictures[5] = new image(50, 50); pictures[5].src = "../spel in jquery/img/bubbles/purple.png"; pictures[6] = new image(50, 50); pictures[6].src = "../spel in jquery/img/bubbles/bom.png"; $(pictures).each(function() { $('div#depionnen').append("<div><img src='"[0]"'</div>"); }); }); </script>
$(pictures).each(function(key, value) { $('div#depionnen').append("<div><img src='" + value.src + "' /></div>"); });
Comments
Post a Comment