I am trying to create a functionality in my project where I have a select box and based on the option selected, I want to change the image displayed on the browser. However, I don't want to manually code all the images into my HTML file. Here is an example of what I currently have:
<select>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<ul>
<li id="myImg">
<img src="images/1.jpg">
</li>
</ul>
While I have set up my HTML structure, I am unsure how to implement the JavaScript needed to achieve this dynamic image change feature. My goal is to be able to select an option from the dropdown menu, have the corresponding image from my local system replace the current one being displayed. Is this feasible or am I asking an impractical question? I would greatly appreciate any assistance with this issue as it is important for my project. Thank you.