I created a dynamic button in html table using java script. Code is in this way
$('#dataTables-data').empty();
jQuery.each(searchTO, function(i, item) {
historyrowid += '<tr><td style=" border: 1px solid black;">' + Math.round(item.SNo * 100) / 100+
'</td><td style=" border: 1px solid black;">' +Math.round( item.DistributorId* 100) / 100 +
'</td><td style=" border: 1px solid black;">' +item.DistributorName+
'</td><td style=" border: 1px solid black;">' +item.Bonuspercent +
'</td><td style=" border: 1px solid black;">' +Math.round( item.PrevCumPV * 100) / 100+
'</td><td style=" border: 1px solid black;">' + Math.round(item.exclpv* 100) / 100 +
'</td><td style=" border: 1px solid black;">' + Math.round(item.SelfBV * 100) / 100+
'</td><td style=" border: 1px solid black;">' + Math.round(item.grouppv * 100) / 100+
'</td><td style=" border: 1px solid black;">' + Math.round(item.Totalpv * 100) / 100+
'</td><td style=" border: 1px solid black;">' + Math.round(item.totalBv * 100) / 100+
'</td><td style=" border: 1px solid black;"><button type="button" class="Downline_button" id="'+item.DistributorId+'" >Downline</button></td></tr>';
});
$('#dataTables-example').append(historyrowid);
and created table is this
But when i create an event on this button nothing is happen.. My event code on button is like this
$(".Downline_button").click(function(){
debugger;
var id = this.id;
});
so please tell me how can i create an event on dynamic button and how can i read button ID ??