get datatable #id from row click event

get datatable #id from row click event

capriscapris Posts: 17Questions: 7Answers: 0

i have set of dynamiclly generated datatables in afor loop with dynamic id's to it. is there a way to get the table id from a row click event.how to bind the row click to each table.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    This is standard jQuery with no DataTables required:

    $('#exampleTable').on( 'click', 'tr', function () {
      var id = this.id;
      ...
    } );
    

    It will work just fine with DataTables as well.

    Allan

This discussion has been closed.