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

112
Visualizações
Javascript how to loop child element of children

I want to read an element's children and for each of the children, read their children.

I have done this but do not understand why it does not work:

var myElement = $('.a-container');
var myChildren = myElement.children();

for(var i = 0; i < myChildren.length; i++) {
     var myGrandChildren = myChildren[i].children();
}

The error I get is myChildren[i].children() is not a function.

Is this not how to achieve what I'm trying to do?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to select the element inside the loop:

myGrandChildren = $(myChildren[i]).children();

Although in this case, jQuery.eq is more suitable:

myGrandChildren = myChildren.eq(i).children();
about 4 years ago · Juan Pablo Isaza Relatório
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