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

209
Views
Accessing one element from an HTMLCollection in a nuxt / vuejs application returns undefined whereas the collection itself is defined

I am trying to add a class to an element that I select like this:

const element = document.getElementsByClassName('some class names')

If I console.log this element (console.log('element?', element), I get a collection of HTML elements; but if I console.log one element (console.log('element[0]?', element[0])), it's undefined.

Does anyone know why I can't access an element from that collection?

enter image description here

const legendSymbol = document.getElementsByClassName("esri-legend__layer-cell--symbols")
legendSymbol[0].classList.add('hidden')
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!