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

129
Views
Cómo usar Javascript for loop para crear botones y llamar a una función de clic

He podido crear los botones usando el bucle for, pero al hacer clic en un botón, elige el último valor en la lista de matrices, ¿por qué?

 //list of propertySidebarItem styles to use to create the buttons for (var i = 0; i < propertySidebarItem.styles.length; i++) { //current property style to use var style = propertySidebarItem.styles[i]; //create the button using the current style var btnElement = document.createElement('button'); btnElement.className = 'btn ' + element.tagName + style.name; //on click of any button, display the button properties btnElement.onclick = function () { //at this stage i am getting the last value in the propertySidebarItem.styles array console.log(btnElement); }; }
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!