如何在新添加的行(DataTables)上添加 onclick 事件? [英] How to add an onclick event on a newly added row (DataTables)?

查看:43
本文介绍了如何在新添加的行(DataTables)上添加 onclick 事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

table.row.add

而且我想,对于添加到表格中的每一行,还向该行添加一个 onclick 事件,以便它链接到一个 URL.

and I want to, for every row that is added to the table, to also add an onclick event to that row so it links to a URL.

那么,如何引用刚刚添加的行来添加这个事件?

So, how do I refer to the row that has just been added to add this event?

推荐答案

您可以在此事件中添加 onclick :

You can add an onclick to this event :

 $(document).ready(function() {
 $('#example').DataTable( {
      "createdRow": function ( row, data, index )
       {
           // here
       }
    } );
 } );

这篇关于如何在新添加的行(DataTables)上添加 onclick 事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆