Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

datatables and toggle not working

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
    });   
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #datatables #toggle #working
ADD COMMENT
Topic
Name
6+8 =