CAUSE
Pages other than first do not exist in DOM at the time of initialization, that is why your handler never gets called.
SOLUTION
You need to use event delegation by providing selector as a second argument in on() call, see example below:
$(document).ready(function(){
$('#table_name').DataTable();
$('#table_name').on('click', '.some-toggle-class', function(){
// your code here
});
});