[JS] Obtener y actualizar elementos de una tabla

/Calcular costos por renglon/ function calcSbt(tableID) { var data = []; var table = document.getElementById(tableID); var rowCount = table.rows.length; var subtotal = 0; if(rowCount > 0){ // limit the user from creating fields more than your limits for (var i = 0, row; row = table.rows[i]; i++) { var cantidad = row.cells[1].children[1].value; var costo = row.cells[6].children[1].value; var sbt = parseFloat(cantidad)*parseFloat(costo); console.log(cantidad+" "+costo+" :"+sbt); if(!isNaN(sbt)){ row.cells[7].children[1].value = sbt.toFixed(2); console.log("Subtotal ["+cantidad+" x "+costo+"]:"+(sbt)); subtotal= parseFloat(sbt)+parseFloat(subtotal); console.log("Sub0:"+subtotal); document.getElementById("lblSbt").innerHTML = "Subtotal: $"+subtotal+"

" $('.autoCurrency').autoNumeric('init'); } } }else{ console.log("No hay elementos"); } }