Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Dynmamically Created Images With JavaScript Not Propery Loading

currently practicing with APIs and working on a project to do a mock up of the Pexels website. Having an issue with the creation of images, but not quite sure why these will not load.

let response = JSON.parse(request.responseText);
      let photoURL = response.photos.map(function (photo) {
        return photo.url;
      });

      console.log(photoURL);

      const imagesContainer = document.querySelector('.images-container');
      imagesContainer.innerHTML = ``;
      photoURL.forEach(photo => {
        const imageDiv = document.createElement('div');
        imageDiv.classList.add('image-div');
        imageDiv.innerHTML = `
          <img class="created-image" src=${photo}>
        `;
        imagesContainer.appendChild(imageDiv);
      });

photoURL is an array of all the image URLs, simply trying to run a forEach on it to attach the src and append to the imagesContainer. Everything seems to be working/appending as planned, but the images will not load. If I look in the chrome dev console, the images will even have the src attribute with links that if I copy paste, do indeed work in the browser.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!