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

147
Views
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 answers
Answer question

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 Report
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!