Avatar of easyrider439

asked on 

add new rows with number of row in 1st colum

I'm sure this question has been asked allot and I've tried to look through previous articles but i'm looking to add new rows to a table and in the first column (cell) I want it to display what number that row is, below is what i have and it just displays #3 in each row. I hope this makes sense. Thanks guys.

function addRow(divname)

var totalrows = document.getElementById('invoice').rows.length-1;

var product = '<?php echo $products; ?>';
var newdiv = document.createElement('<tr>');	
    newdiv.innerHTML = "<td><strong>" + (totalrows + 1) + "</strong></td><td><div class='field'><select name='product[]' id='product'><option selected='selected'></option>" + product + "</select></td>";

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon