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

301
Views
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 answers
Answer question

0

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

needs to be

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

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!