I have a DataTables which I need to set 2 inputs in the same column. I know how to get the value if there is one input per column as below:
var table = $('#example').DataTable();
table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var cell = table.cell({ row: rowIdx, column: 0 }).node();
console.log($('input', cell).val());
});
How can I get the two values?
table.cell({row: rowIdx, column:0}).node().find('#inputOne');
Advertisement
Answer
Map the values to array
var values = $(cell).find(':input').map(function(){
return this.value
}).get();
console.log(values);