📜  数据表下拉切换不起作用 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:58.587000             🧑  作者: Mango

代码示例2
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
    });   
});