Skip to content Skip to sidebar Skip to footer

Generate Rows In A Table Using Javascript

I'm trying to use javascript to insert new rows in a table when I click a button .This is the table that I'm using. ).getElementsByTagName('tbody')[0]; var i=row.parentNode.parentNode.rowIndex; var new_row = x.rows[2].cloneNode(true); varlen = x.rows.length; new_row.cells[0].innerHTML = len; var inp1 = new_row.cells[1].getElementsByTagName('input')[0]; inp1.id += len; inp1.value = ''; var inp2 = new_row.cells[2].getElementsByTagName('select')[0]; inp2.id += len; inp2.value = ''; //alert(i);//x.appendChild( new_row ); console.log(i); x.insertBefore( new_row, row.parentNode.parentNode);

}

Post a Comment for "Generate Rows In A Table Using Javascript"