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

148
Visualizações
Array loop not showing all the data?

Hello i need some help as my array is not showing everything display

The picture show there 3 array data but however one is display only as this is the on i written to display for 1 i have included a for loop but it seems not working here my code for it

i have JSON.phase to it call responses

This is my array response

[{"Recyclable": "unknown recyclable name"},{"Recyclable": "some recyclable name"},{"Recyclable": "another recyclable"}]

enter image description here

This is my code

const responses = JSON.parse(user.CdsRecyclables)


document.getElementById('name').value = "" + responses[0]["Recyclable"]

for (let i = 0; i < responses.length; i++) {
  responses[i]["Recyclable"] + "<br>";
}
<div class="container-body ">
  <fieldset class="Field">
    <label id="symbol">-><input id="name" disabled></label>
  </fieldset>
</div>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try this code and let me know if this solves your problem

let responses = [{"Recyclable": "unknown recyclable name"},{"Recyclable": "some recyclable name"},{"Recyclable": "another recyclable"}]

let field = document.querySelector(".Field");
let str = "";

for (let i = 0; i < responses.length; i++) {

    response = "" + responses[i]["Recyclable"]
    str += `
        <label id="symbol">-><input id="name" disabled value="${response}"></label><br/>
    `;
    field.innerHTML = str;

    console.log(response)
    
}
about 4 years ago · Juan Pablo Isaza Relatório
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