JSFiddle - React, Tailwind, and code Playground

by Pragnesh Chauhan

HTML

<table id="mytable">
    <tr>
        <td><input type="textbox" class="mytb"/></td>
        <td><button id="addButton">Add New Row</button></td>     
    </tr>
</table>

JavaScript

$(document).ready(function(){
    
    // generate new row
    $('#addButton').on('click', function(event){
      event.preventDefault();                 
      var newRow = '<tr><td><input type="text" class="newtb"/></td></tr>';
      $('#mytable').append(newRow);        
    });
    
    // capture click of new row?
    $('body').on('click', '.newtb', function(event){
        event.preventDefault();  
        alert('clicked');
    });
});