0

I am using jquery datatable to show data. Let I am displaying id,name,pass and controls. In id,name,pass data is showing but in controls in each row there is a button.

I want to get the row info when I click the button only. I know how to get data or that specific row when clicked in that whole row. But I want to get the info in button click only.

I used following code to display row when click in the row itself.

$('#example tbody').on( 'click', 'tr', function () {
      console.log( table.row( this ).data() );
  } );
Scott
  • 1
  • 2

1 Answers1

0

You can also get the data on button click but cannot only get data on button click because of jquery data table plugin's functionality. and if you want to get the data on button click then you can simply write class of your button instead tr on click function as follows:

     $('#example tbody').on( 'click', '.CLASS', function () {
             console.log( table.row( this ).data() );
     } );
Vatsal Patel
  • 571
  • 5
  • 11