I used following code to insert some buttons inside different table rows:
$('#' + data.Symbol).append('<td><button id="deletestock' + data.Symbol + '" type="submit" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span></button></td>');
And then when I tried to set an onclick listener to these button, they didn't work, my code of listener is as follow:
$(function(){
$('button').on('click', function(event){
alert(this.id);
});
});
Could you please help me with this? Thank you so much!