Datatable - Execute js code after pagination change

741 views Asked by At

My code...

$(document).ready(function () {
    my_func();
}

function my_func(){
    $(".my_class").css("background","red");
}

...seems that works only on displayed elements, but is not working on hidden elements, that are in the oter page of Datatable pagination.

My solution could be putting my_func() calling after the page-change. But how?

Other solution?

1

There are 1 answers

1
Gianluca Demarinis On

My first solution

$('#example').dataTable( {
    "drawCallback": function( settings ) {
        alert( 'DataTables has redrawn the table' );
    }
} );