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

198
Views
JavaScript get elements by class not working

I'm trying to get some images to work with lightbox but I do not want all images on that site to react to the eventlistener.

This is how my images are declared:

<img class="thumbnail" id="imga" src="~/lib/images/IC/Bild1,5_Pirellival.png"/>

This is what I tried but it is not working:

const images = document.getElementsByClassName('thumbnail')

I do not want to use querySelectorAll('img') because this would mess up my other images on the same page.

Any advice?

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!