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

176
Views
I want to display images when i click on it

I cannot display images when I click on the target. I have nine images and I need to display them as soon as I click on images.

const btns = document.querySelectorAll('.btn-modale');

const modaleEquipement = document.querySelector('.bloc-modale');

const fermetureModale = document.querySelector('.fermeture-modale');

const imgIndex = document.querySelector('.bloc-modale img');


btns.forEach(btn => {

    btn.addEventListener('click', (e) => {

        imgIndex.src = `ressources/img${e.target.getAttribute('data-index')}-equip.jpg`;
        modaleEquipement.classList.add('active-modale');

    });

});
<button type="button" data-index="1" class="btn-modale"></button> 
<button type="button" data-index="2" class="btn-modale"></button>
<button type="button" data-index="3" class="btn-modale"></button>
<button type="button" data-index="4" class="btn-modale"></button>
<button type="button" data-index="5" class="btn-modale"></button>
<button type="button" data-index="6" class="btn-modale"></button>
<button type="button" data-index="7" class="btn-modale"></button>
<button type="button" data-index="8" class="btn-modale"></button>
<button type="button" data-index="9" class="btn-modale"></button>
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!