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

153
Visualizações
How to find index of array of class elements?

I have a list of svg objects with a certain class name 'test'.

list = document.getElementsByClassName('test')

I want to find the index of an object in the list (e.target) when it is clicked via an event listener. But it's freezing up.

The smallest example that gives an error would be the following:

list.indexOf(list[1])

which should return 1 but doesn't. I think the problem is that getElementsByClassName gives an "array-like" list, not an actual array. But I can't figure out how to get by it.

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