Full-Stack freelance Umbraco developer in the UK.

George Phillipson - Freelance Umbraco developer

Add new table row using jQuery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<table id="addExtraTd">
<tbody>
  <tr>
    <td>TD 1</td>
  </tr>
</tbody>
</table>
<button id="btnAddTd">Add New TD</button>
$(document).ready(function(){
var count = 1;
    $("#btnAddTd").click(function(){
        $('#addExtraTd > tbody:last-child').append('<tr><td>TD ' + ++count + '</td></tr>');
    });
});

Please enter your comment.