I'm developing an online poster creator and I could use some guidance on how to set an image as the background of a div element. I'm a bit lost on where to begin.
Currently, I have a div containing a selection of images and an empty div with just an ID.
This is my image selection div:
<div id="imgopt">
<ol>
<li>
<img src="asset/img/template1.jpg">
</li>
<li>
<img src="asset/img/template2.jpg">
</li>
<li>
<img src="asset/img/template3.jpg">
</li>
<li>
<img src="asset/img/template4.jpg">
</li>
</ol>
</div>
This is my Empty Div:
<div id="designPoster">
</div>
Essentially, I need help with writing the JavaScript code or getting some guidance on how to make it possible to set the background image of the empty div[id="designPoster"]
by selecting an image from the div[id="imgopt"]
.