title: Fetch an url img data and set it in a src attribute of an img in my html
body: <p>I ´m fetching from a weather api information to my app. I manage to bring and change info in my html for the &quot;location-timezone&quot;, &quot;temperature-degree&quot; and &quot;tempemperature-description&quot;; but I´m having trouble changing mi &quot;temperature-icon&quot; to de api icon.</p>
  <p>This is the section of my html I am working:</p>
  <pre><code>&lt;div&gt;
    &lt;div class=&quot;w-location&quot;&gt;
      &lt;h6 class=&quot;location-timezone&quot;&gt;Timezone&lt;/h6&gt;
    &lt;/div&gt;
    &lt;div class=&quot;w-icon&quot;&gt;
      &lt;img id=&quot;temp-icon&quot; src=&quot;imagenes/calendar.png&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;w-temperature&quot;&gt;
      &lt;p class=&quot;temp-degree&quot;&gt;7 ° &lt;span&gt;C&lt;/span&gt;&lt;/p&gt;
      &lt;p class=&quot;col-6 temp-description&quot;&gt; Freezen &lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>This is my javasript where I bring the info from de api and made the functions to change info in my html:</p>
  <pre><code>
  window.addEventListener('load', () =&gt; {
   let long;
   let lat;
   let data;
   let newIcon;
   let locationTimezone = document.querySelector(&quot;.location-timezone&quot;);
   let tempDescription = document.querySelector(&quot;.temp-description&quot;);
   let tempDegree = document.querySelector(&quot;.temp-degree&quot;);
  
   if (navigator) {
     long = -87.627778;
     lat = 41.881944;
  
     const api = `http://api.weatherapi.com/v1/current.json? 
     key=db5d332edd014d29aa1175108201908&amp;q=${lat},${long}`;
  
     fetch(api)
       .then(response =&gt; {
       return response.json();
       })
       .then(function (json) {
       data = json;
   
       //set DOM elements from the API
       locationTimezone.textContent = data.location.tz_id;
       tempDescription.textContent = data.current.condition.text;
       tempDegree.textContent = data.current.temp_c;
       newIcon = data.current.condition.icon;  
       })
     } else {
        h1.textContent = &quot;Geolocation not working&quot;
     }
  });
  </code></pre>
  <p>How can I set the newIcon information into my img (id=#temp-icon src=&quot;&quot;) in my html?</p>
  <p>Thanks!!</p>