Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

106
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda