【问题标题】:jQuery datatables row click after data loaded by fnReloadAjaxjQuery数据表行在fnReloadAjax加载数据后单击
【发布时间】:2018-01-16 07:35:11
【问题描述】:

我使用 fnReloadAjax 每 1 秒重新加载一个数据表。 现在我需要在点击行上使用函数:

 $(".table td").click( function( e ) {
            alert('a');
        });

但什么也没发生。

【问题讨论】:

  • 你需要 row 然后使用 tr

标签: jquery ajax html-table


【解决方案1】:

尝试使用event delegation

$(".table").on('click', 'tr', function(e) {
    alert('a');
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-05
    • 2015-09-07
    • 1970-01-01
    • 2016-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-07
    相关资源
    最近更新 更多