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

250
Views
Tengo un problema con el uso de obtener elemento por nombre de clase

cuando uso el nombre getElementByClass, se ejecuta de arriba a abajo del documento, por lo tanto, selecciona los elementos que están en la parte superior del documento antes que los elementos en la parte inferior del documento. Entonces, ¿es posible cambiar eso, tal vez en lugar de obtener otra colección html, solo actualizará la colección html? Mire el código para comprender la pregunta. ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

 const hi = document.getElementsByClassName("hi"); let hey = document.getElementsByClassName("hey"); // it will return an html collection with <p class="hey"> one</p> as the only element // then if i add hey class to hi hi.classList.add("hey") //add i getElementsByClassName("hey") hey = document.getElementsByClassName("hey"); //then it will return an html collection with // <p class="hi hey"> two </p> as the first item // and <p class="hey"> one</p> as the second item // my question is that is it possible for <p class="hey"> one</p> to be the first item since it // was the first element to have the class name hey // and <p class="hi hey"> two </p> to be the second item
 <p class="hi">two</p> <p class="hey">one</p>

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