function addCol() {
    var table = document.getElementById('table');
    var length = table.childElementCount;
    var trs = table.childNodes;
    var td;
    for (var i = 0; i < length; i++) {
        if (i == 0) { // first row contain header of table.
            td = document.createElement('th');
        } else {
            td = document.createElement('td');
        }
        td.setAttribute('class', 'column');
        var textarea = document.createElement('textarea');
        textarea.setAttribute('class', 'table_text_area');
        td.appendChild(textarea);
        trs.item(i).appendChild(td);
    }
}
/**
 * Add one column on end of table #table.
 */
Add one column on end of table #table.
Add one column on end of table #table .
function addCol() {
    var table = document.getElementById('table');
    var length = table.childElementCount;
    var trs = table.childNodes;
    var td;
    for (var i = 0; i < length; i++) {
        if (i == 0) { 
            td = document.createElement('th');
        } else {
            td = document.createElement('td');
        }
        td.setAttribute('class', 'column');
        var textarea = document.createElement('textarea');
        textarea.setAttribute('class', 'table_text_area');
        td.appendChild(textarea);
        trs.item(i).appendChild(td);
    }
}
function addCol ( ) { var table = document . getElementById ( 'table' ) ; var length = table . childElementCount ; var trs = table . childNodes ; var td ; for ( var i = 0 ; i < length ; i ++ ) { if ( i == 0 ) { td = document . createElement ( 'th' ) ; } else { td = document . createElement ( 'td' ) ; } td . setAttribute ( 'class' , 'column' ) ; var textarea = document . createElement ( 'textarea' ) ; textarea . setAttribute ( 'class' , 'table_text_area' ) ; td . appendChild ( textarea ) ; trs . item ( i ) . appendChild ( td ) ; } }
Add one column on end of table #table.
Add one column on end of table #table .
// first row contain header of table.