I have created dynamic checkbox using jquery based on the data from a web service.
var checkbx = '<td><input type="checkbox" class="select_ticket" data-id="'+ newjsondata[i].id +'"/></td>';
tr.append(checkbx);
When I click on the checkboxes nothing happens, in other words the events do not respond.
function test() {
console.log('okokok');
var id = $(this).data("id");
alert(id);
}
$( ".select_ticket" ).on( "click", test );
I event tried with click and change events without any success.
Can someone help me understand on where I have made a mistake.