Why jQuery is not working with DataTable?

Viewed 23

I want to create a new datatable but when I try to add jQuery "click()" function its not really working. For Example:

$('#dataTable').DataTable();
$('.example').on('click', function(){
    alert("This is not working");
})

This will not work. But if I create a drawcallback function:

$('#dataTable').dataTable({
    "drawCallback": function() {
        $('.example').on('click', function(){
            alert("This will work");
        })
    }
}); 

Its working perfectly. Where I make a mistake? How can I make functions work without calling drawcallback? Thank you! Have a nice day!

0 Answers
Related