I have a checkbox inside jquery datatable which is created dynamically with the code below.
$('#SettingsDatatable').dataTable({
"order": [],
"dom": "Bfrtip",
"buttons": ["copy", "csv", "excel", "pdf", "print"],
"columnDefs": [{
"targets": 0,
"render": function (data, type, full, meta) {
return '<input type="checkbox" ' + (data == 'True' ? 'checked' : '') + ' /> <a href="#" data-toggle="modal" data-target="#" title="Edit"><i class="glyphicon glyphicon-pencil"></i></a>';
}}
Now I want to select this checkbox with code below.
$('#SettingsDatatable input[type="checkbox"]').on('click', function (event) {
alert("Hello in");
});
But its not getting selected.
Update
$('#SettingsDatatable').on('click', 'input[type="checkbox"]', function (event) {
event.preventDefault();
event.stopPropagation();
return false;
});