I use jQuery Datatable for listing records and add an Action button (Edit) for editing the record on a modal dialog. If I select a row I can get th
jQuery Datatable
Action
Here's the full source code. Hope this helps :)
//when button (edit button here) is clicked.... Note: no need id for buttons too, just use tag $('table button').click(function() { var tr = $(this).closest('tr'); var id = tr.children('td:eq(0)').text(); //get the text from first col of current row console.log(id); //you'll get the actual ids here });
Id Name Surname Action 1 Hans Jahnsen Edit 2 Robert Boylstat Edit 3 Jim Alexi Edit