Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

107
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda