I have check box as one of the columns in my table which uses DataTable plugin. Here I get the selected rows in a array and trying to access the value of the second column of each of these selected like below.
I am getting 'undefined' instead of first column's value. I am not sure what is wrong.
I arrived at the above code based on a snippet provided by Allan in the following thread http://datatables.net/forums/discussion/1384/getting-table-cell-values
I have given below the same snippet for easy reference
Thanks!
$('#submit_id').click(function () {
var sData = oTable.$('input').serializeArray();
for(var i=0; i<sData.length; i++){
var $selectedRecNo = parseInt(sData[i].value);
alert($('td:eq(1)', $('#firstTable-id tbody tr:nth-child(' + $selectedRecNo+ ')')).html()); // undefined
);
}
});
I am getting 'undefined' instead of first column's value. I am not sure what is wrong.
I arrived at the above code based on a snippet provided by Allan in the following thread http://datatables.net/forums/discussion/1384/getting-table-cell-values
I have given below the same snippet for easy reference
$('#firstTable-id tbody tr').click( function () {
// Alert the contents of an element in a SPAN in the first TD
alert( $('td:eq(1) ', this).html() );
} );
Thanks!