Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda