+ 1
How can I add the background image url from a loop of images ?
d.style.backgroundImage="url(images[0]+'.jpg' )";
2 odpowiedzi
+ 5
You are already doing it but wrong syntax .
Use template strings ,
d.style.backgroundImage=`url(${images[0]}.jpg)`
or
d.style.backgroundImage="url("+images[0]+".jpg)";
+ 2
Thank you so much