jquery - Get an image from an array -
i'm trying place image array div.
arralegro =[ "01.png", "02.png", "03.png", "04.png"]; n=2; var goimg = 'alegro/' + arralegro[n]; alert (goimg); //correct - `alegro/02.png` $('#divr').empty(); $("#divr").prepend('<img id="slide" src=' + goimg + '/>'); // here wrong
firebug says - 404 not found
. image there.
$("#divr").prepend('<img id="slide" src="alegro/02.png"/>'); // works way
i think might forgetting double quotes around src attribute. try line:
$("#divr").prepend('<img id="slide" src="' + goimg + '" />'); // here wrong
Comments
Post a Comment