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

270
Views
JQuery: div más cercano que tiene una identificación

¿Cómo escribiría Jquery para obtener el div más cercano que realmente tiene una ID definida?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Debe usar tiene selector de atributo . Esta muestra debería hacer el trabajo:

 $('selector').closest('[id]')
over 4 years ago · Santiago Trujillo Report

0

$(elementToStart).parent().closest('div[id]');

Uso parent() para evitar simplemente obtener el elemento en sí.

Ejemplo: http://jsfiddle.net/zQRFT/1/

over 4 years ago · Santiago Trujillo Report

0

Busque un atributo de identificación en un div, utilizando el método más cercano :

 $(this).closest('div[id]');

Los corchetes [id] allí son lo que se llama el Selector de atributos Has

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!