'running DOM tags

What I am trying to do is when the script is called I want it to call another id within the Dom and display the image of that particular id. The following script calls on the selected Value.

<script>      
  document.querySelector('select').onchange = function() {   
    document.querySelector('#ree').innerHTML = this.value;
  }
</script>
<div id="ree"></div>


Solution 1:[1]

What you can do is use a img tag inside your #ree div and then

<script>
        
     document.querySelector('select').onchange = function() {
     
     document.querySelector('#ree img').src = this.value;
}
</script>

the div

<div id="ree">
   <img>
</div>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Efraim Jerszurki