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

273
Views
¿Es getElementById o getElementsByClassName[0] más rápido?

¿Es más rápido usar getElementById?

 document.getElementById('foo').style.visibility = 'visible';

o getElementByClassName[0]

 document.getElementsByClassName('foo')[0].style.visibility = 'visible';

He leído que demasiadas identificaciones pueden obstaculizar el rendimiento, razón por la cual estoy tratando de alejarme de las identificaciones. Pero si es más rápido usar una identificación para una búsqueda rápida de JavaScript, lo haré con gusto.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

getElementById sería el método más rápido, ya que es una búsqueda de tabla simple.

getElementsByClassName lo mismo que querySelector casi el doble de lento .

Para obtener el mejor rendimiento, use ID para javascript y clases para CSS.

about 4 years ago · Juan Pablo Isaza 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!