I am trying to get the values for Date1 Date2 Date3 Date4 for each of the rows so rows would be equal to an array [], and rows[0] would be [3,3,4,6] and rows[1] would be [93.9,99,98.9,99]...
see JS Fiddle here http://jsfiddle.net/HLhT4/1/
$(function() {
var $table = $("#work_table"),
$headerCells = $table.find("th"),
$rows = $table.find("tr tr");
var headers = [],
rows = [];
$headerCells.each(function(k,v) {
headers[headers.length] = $(this).text();
});
$rows.each(function(row,v) {
$(this).find("td").each(function(cell,v) {
if (typeof rows[cell] === 'undefined') rows[cell] = [];
rows[cell][row] = $(this).text();
});
});
console.log(headers);
//console.log(rows);
alert(headers);
alert(rows);
});
I already have the headers.
Note: maybe I need to change the class and id attributes.
tr tr? That looks for rows within rows.