I am using jquery datatable with an action column. In that action column there is two links "edit" and "delete". My table is populating correctly with this action column. But problem is I need to open a bootstrap modal with a from when I click on the edit button of this datatable. But its not open my modal.
This is how I create my action column in datatable:
var myTable =
$('#view_user_table')
.DataTable({
bAutoWidth: false,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "includes/process_view_bank_datatable.php",
"aoColumnDefs": [{
"aTargets": [6],
"bSortable": false,
"mData": "0",
"mRender": function (data, type, full) {
return '<div class="hidden-sm hidden-xs action-buttons">' +
'<a class="green edit_this_user" href="javascript:void(0)" data-bank_id="'+data+'">edit</a>' +
'<a class="red" href="javascript:void(0)">delete</a>' +
'</div>';
}
}
],
"aaSorting": [],
"iDisplayLength": 50,
select: {
style: 'multi'
}
});
Then I tried to open my modal with click on the edit link I have created above.
This is how I tried it:
$('.edit_this_user').on('click', function() {
alert('modal')
});
But I cannot get the alert. Can anybody tell me what is the reason to its not working?
Note: I can not get any error in my console.