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

201
Views
¿Cómo selecciono varias filas en una tabla html presionando la tecla ctrl o la tecla shift?

Tengo una tabla html simple donde las filas se crean dinámicamente y los valores se insertan en las celdas. Este es el código:

 var table=document.getElementById("emp"); var row=table.insertRow(0); var cell = row.insertCell(0); var cell1 = row.insertCell(1); var cell2 = row.insertCell(2); cell.innerHTML="<b>Name:</b>"; cell1.innerHTML="<b>Age:</b>"; cell2.innerHTML="<b>Address:</b>"; var row1=table.insertRow(1); var cell3=row.insertCell(0); var cell4=row.insertCell(1); var cell5=row.insertCell(2); cell3.innerHTML="Alex"; cell4.innerHTML=23; cell5.innerHTML="Chicago";

Ahora, quiero poder seleccionar varias filas en mi tabla, usando Ctrl o Shift . ¿Cómo puedo hacer eso? Por favor, ayúdame.

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

0

Puede verificar dentro de su controlador de clics si se presiona una tecla y, de ser así, realizar la acción apropiada

 const trs = document.querySelectorAll('tr'); trs.forEach(tr => tr.addEventListener('click', (e) => { console.log(e.shiftKey); // Will print true if shift is pressed. }))
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!