I've had a hard time getting dynamic rows inputs to multiply 'onchange' of the value in the input in each row. It works in the first row inserted no matter what rowindex that row is moved to. All following rows only accept the initial input value and never change the 'cost' innerHTML of the colRow. I figure I need a parentNode.parentNode syntax to make this function work in all rows. Every thing is Client-side javascript and all rows are inserted to 'cartbody.insertRow[0]'.
'qtymultiply()' Function As is:
function qtymultiply(){
var cartitems=document.getElementsByClassName('itemrow');
var colRows=cartitems;
for(var i=0; i < colRows.length; i++)
{
var oRow=colRows[i];
var price=oRow.cells[4].innerHTML;
var qty=oRow.cells[5].getElementsByTagName('input')[0].value;
var cost=oRow.cells[6]; //not recognized for each row only first row- //inserted
var multiply=0.0;
multiply+=price*qty;
}
cost.innerHTML=multiply.toFixed(2); //need the 'cost' of each row to-
//change not just the first row inserted?
sumsubtotal(); //re-adds 'subtotal'
}
Any suggestions for a parentNode syntax on the 'itemrow' would be greatly appreciated.