I am trying to do the following,
I have a table within the table I have an input with a button when the button is clicked a new row is added, I then wish to capture any click upon a new row element.
<table id="mytable">
<tr>
    <td><input type="textbox" class="mytb"/></td>
    <td><button id="addButton">Add New Row</button></td>     
</tr>
</table>
$(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?
$('.newtb').on('click', function(event){
    event.preventDefault();  
    alert('clicked');
});
});
I am stuck in that the new row is created but the click event is not captured.
If anyone could point me in the right direction I would be very grateful, but could someone please explain why this is happening as I am really stuck and want to increase my JavaScript knowledge.
 
     
     
     
     
    