Answers for "get data from column in table js"

0

get data from column in table js

function getDataFromColumn(table_id, col) {
    var tab = document.getElementById(table_id);
    var n = tab.rows.length;
    var i, s = null, tr, td;
    var ss = '';

    if (col < 0) {
        return null;
    }

    for (i = 1; i < n; i++) {
        tr = tab.rows[i];
        if (tr.cells.length > col) { 
            td = tr.cells[col];      
            ss += ' ' + td.innerText + ',';
        } 
    }
    return ss;
}

var txt =getDataFromColumn('table_ID', 5);
Posted by: Guest on August-19-2020

Code answers related to "get data from column in table js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language