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

151
Views
¿Cómo actualizar el color de varias celdas haciendo clic y arrastrando las celdas de la tabla?

El siguiente script generó una tabla cuyo color de celda se puede actualizar haciendo clic en él. Estaba tratando de actualizar el código de manera que con un solo clic y arrastrar (selección múltiple) debería poder actualizar los colores de varias celdas y no tengo ideas para ello.

 const table = document.getElementById("table"); table.innerHTML = ""; // size has a value for number of column and rows for (let i = 0; i < this.size; i++) { let tr = document.createElement("tr"); for (let j = 0; j < this.size; j++) { let td = document.createElement("td"); td.classList.add("border-clr"); // backRBG is a variable that stores my color and backRBG2 is a variable that stores my clicked color td.style.backgroundColor = backRGB; td.onclick= () => { td.style.background= backRBG2 } tr.appendChild(td); } table.appendChild(tr); }

Gracias de antemano.

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!