table td to array
function tableToArray(table) { var data = []; for (var row = 0; row < table.rows.length; row++) { var tableRow = table.rows[row]; var rowData = {}; for (var col = 0; col < tableRow.cells.length; col++) { rowData[tableRow.cells[col].getAttribute('data-key')] = tableRow.cells[col].innerHTML; } data.push(rowData); } return data; }