Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

302
Vistas
colspan on cell do not work on collapse table when display none and again display: table-cell

Problem is when I click on the button then the cell I collapsed. That works. Then when I click one more time, then the row is colspan-1 in spite of colspan-3. What should I do to make row colspan 3 when click again. Look on border for cell a. This is live code https://jsfiddle.net/dok6sxu4/8/

const collapseDetailsTransaction = () => {
    const details = document.getElementById(`details`);
    const caret = document.getElementById(`collapse-button`);
    if (details.style.display === "none") {
      details.style.display = "table-cell";
      caret.style.transform = "rotate(180deg)";
    } else {
      details.style.display = "none";
      caret.style.transform = "rotate(0deg)";
    }
  };
<table border="1">
    <tr>
      <td>col1</td>
      <td>col2</td>
      <td>
        <button onclick="collapseDetailsTransaction()" id="collapse-button">klik</button>
      </td>
    </tr>
    <tr id="details"><td colspan="3">a</td></tr>
</table>

gif show this problem

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

details.style.display = "table-cell";

needs to be

details.style.display = "table-row";

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda