Javascript onclick append a new row to table

Javascript innerHTML() method

    <title>Append a new row in table</title>

<h1>Append a new row in table</h1>
<table id="tb">
        <th>Table heading1</th>
        <th>Table heading2</th>
        <td>Table docuemnt1</td>
        <td>Table docuemnt2</td>

<button onclick="app()">Append new row</button>

function app() {
    var x = document.getElementById('tb');
    // get table data
    var d = x.innerHTML;
    x.innerHTML=d+'<tr><td>Table docuemnt1</td><td>Table docuemnt2</td></tr>';


Related Sourcecode

More Sourcecode

Google login
SignUp with Email