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

101
Views
Is there any cleaner way to create a div in jQuery? I'm currently concatenating every HTML line

I'm looping over an array of images, creating the div that will contain all the information and then appending it to the div that will contain them. What I've done is working just fine, however, I've been wondering if there's a cleaner way to do what I'm doing right now:

    artworks.records.forEach((artwork, i) => {
        const record = `<div class='artwork'>` +
            `<div class='artwork-image-container'>` +
                `<img class="artwork-image" src="${artwork.images.length > 0 ? artwork.images[0].baseimageurl : './assets/no-image-available.png'}" alt="${artwork.title}" />` +
            "</div>" +
            "<div class='image-description-container'>" +
                `<p class="image-description">${artwork.title}</p>`
            "</div>" +
        "</div>";
        divToBeRenderedIn.append(record);
    });
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!