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

453
Views
jQuery: ¿cómo comprobar si existe un elemento?

Sé que puede probar el width() o el height() pero ¿qué pasa si la propiedad de visualización del elemento está configurada en ninguno? ¿Qué otro valor hay que comprobar para asegurarse de que el elemento existe?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Puede usar la longitud para ver si su selector coincidió con algo.

 if ($('#MyId').length) { // do your stuff }
over 4 years ago · Santiago Trujillo Report

0

Suponiendo que está tratando de encontrar si existe un div

 $('div').length ? alert('div found') : alert('Div not found')

Consulte el ejemplo de trabajo en http://jsfiddle.net/Qr86J/1/

over 4 years ago · Santiago Trujillo Report

0

Puedes usar el selector visible:

http://api.jquery.com/selector-visible/

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!