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

363
Views
Obtener el segundo elemento secundario

Todavía soy nuevo en jquery y tengo este código

 <div> abcsdf <div> first child</div> <div> second child</div> </div>

Quería obtener el segundo hijo, se completan dinámicamente usando append y no sé cómo obtenerlo.

quería mostrar

$('the second element inner html here').dialog() etc..

Espero que alguien pueda ayudarme.

Gracias

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Varias maneras de hacer esto. Voy a suponer que el div de nivel superior tiene una identificación de 'superior'. Este es probablemente el mejor:

 $('#top > :nth-child(2)').whatever();

o

 $('#top').children(':first-child').next().whatever();

o si sabe a ciencia cierta que hay al menos 2 niños

 $($('#top').children()[1]).whatever();
over 4 years ago · Santiago Trujillo Report

0

mira este enlace

Selector de niños enésimo

O puedes probar :eq Selector también

Selector de ecualización

over 4 years ago · Santiago Trujillo Report

0

Utilice el selector de n-ésimo hijo . Por ejemplo: $('div:nth-child(2)')

over 4 years ago · Santiago Trujillo Report
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!