get the corresponding table header for each td element

get the corresponding table header for each td element

SaranGaneSaranGane Posts: 1Questions: 0Answers: 0

Hi all,

I am using javascript code to highlight a row from datatable and i printed the array values successfully ... But now i want to display the table header also with the td elements,,,

```

<

script>
function test(){
var iColumns = $('#<?php echo uniqid(); ?> thead th').length;
var dataArr = [];
$.each($("#<?php echo uniqid(); ?> tr.selected"),function(){
for (i=0;i<iColumns;i++)
{
dataArr.push($(this).find('td').eq(i).text());

    a=dataArr[i];
        }
});
//console.log(dataArr.join('\r\n'));
alert (dataArr.join('\r\n'));
}               
    </script>   

This code dispalys the td elements only ... at the mean time i also need field name also... so anybody guide me....

Thanks.

This discussion has been closed.