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

107
Views
jquery loop add elements onclick

I am really new with javascript

I am trying to loop my json then add the images to my html, then i need to make it so when i click on that image it shows me the File from my json

          var obj = JSON.parse(data);
          for (index = 0; index < obj.length; ++index) {
            
            var file = obj[index]['File'];
            var image = obj[index]['Image'];

            var test = $( ".row" ).append( 
              `<div class="column">
                <div class="card">
                  <img src="${image}" alt="Avatar" style="width:100%">
                  <div class="container">
                    <h4>
                      <b>Title</b>
                    </h4>
                  </div>
                </div>
              </div>`
              );

              test.click(function(e) {
                alert(file);
              });
  
              console.log(file);
              console.log(image);
            }
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!