Yngvarr

Generation

generate functionSat, 25 Mar 2023

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; }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant