HTML JS

HOW TO ADD TABLE ROWS & CELLS IN JAVASCRIPT

<table id="demoA">   <tr> <td>A</td> </tr> </table>

GET TABLE var table = document.getElementById ("demoA");   INSERT ROW var row = table.insertRow();   INSERT CELLS var cell = row.insertCell(); cell.innerHTML = "B";

ADD TABLE ROWS & CELLS

01

var table = document.querySelector ("#demoB tbody");   table.innerHTML +=  "<tr><td>B</td></tr>";

<table id="demoA">   <tr> <td>A</td> </tr> </table>

MANUAL ADD HTML STRING

02