HTML JS

REMOVE TABLE ROWS & CELLS IN JAVASCRIPT

<table id="demoA">   <tr><td>A</td> <td>B</td></tr>   <tr><td>C</td> <td>D</td></tr> </table>

GET TABLE var table = document.getElementById("demo");   REMOVE SECOND ROW table.deleteRow(1);   REMOVE FIRST CELL OF FIRST ROW var firstRow = table.rows[0]; firstRow.deleteCell(0);

REMOVE ROW & CELL

01

<table>   <tr>     <td>A</td> <td id="cellA">B</td>   </tr>   <tr id="rowB">     <td>C</td> <td>D</td>   </tr> </table>

REMOVE ROW B document.getElementById("rowB") .remove();   REMOVE CELL A document.getElementById("cellA") .remove()

ALTERNATIVE METHOD

02