Get element data from a selected row using jquery and select plugin
Get element data from a selected row using jquery and select plugin
itajackass
Posts: 162Questions: 48Answers: 3
Using this i'd like to show using jquery some values on select using CHECKBOXES. See alert code.
var table= $('#table').DataTable( {
dom: 'Bfrtip',
"columnDefs": [
{
orderable: false,
className: 'select-checkbox',
targets: 0
}
],
select: {
style: 'multi',
selector: 'td:first-child'
}
}).on( 'select', function ( e, dt, type, indexes ) {
var rowData = table.rows( indexes ).data();
alert( $(rowData).find(".in").val() ); // <-- doesn't work
alert( $(rowData).find(".btn").data("content") ); <-- doesn't work
} );
<table id="table">
<thead>
<tr>
<th/></th>
<th data-priority="1">Data</th>
<th data-priority="2">Button</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td><input type="text" class="in" value="hello"></td>
<td><button type="button" class="btn" data-content="test"></td>
</tr>
</tbody>
</table>
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Ok done using var rowData = table.rows( indexes ).nodes();