table td to array
function td2array(table) { var rows = $('tr', table); var tbody = rows.parent(); var ret = []; for (var i = 0; i < rows.length; i++) { var row = rows[i]; var cols = $('td', row); for (var j = 0; j < cols.length; j++) { var col = cols[j]; var text = col.innerText; if (text === '') { text = '0'; } ret.push(text); } } return ret; }