document.getElementById("prdAntal").value ^ That line gets the quantity number from the input-field. This script is executed on keyup and it displays the total price for the product in a div. Is there any way I can make it faster? I appreciate all suggestions. Parameters, "prisDiv" is the div where the total price will be displayed. "pris" is the price of the product. Variables, "antalPrd" = that gets the number of how many quantity-input fields there is. (just so I can calculate all products) "prdSumma" = total price of the product. (Quantity * Price) "moms" = VAT "totalt" = the absolute total price for all the total prices. (lol) function editPris(prisDiv,pris) { var antalPrd = document.getElementById("prdAntal").value; var prdSumma = 0; var moms = 0; var totalt = 0; if(document.getElementById(prisDiv+"_input").value != ""){ if(!isNaN(document.getElementById(prisDiv+"_input").value)){ document.getElementById(prisDiv).innerHTML=" ("+document.getElementById(prisDiv+"_input").value*pris+" kr)"; }else{ document.getElementById(prisDiv).innerHTML=" (0 kr)"; } document.getElementById(prisDiv).style.display = "block"; for (i=0;i<=antalPrd;i++){ var x = parseInt(document.getElementById("prdPris"+i).value); var y = parseInt(document.getElementById("pris"+i+"_input").value); if(isNaN(x)){ x=0; } if(isNaN(y)){ y=0; } prdSumma += x*y; moms = prdSumma * 0.25; totalt = prdSumma + moms; document.getElementById("summa").innerHTML=prdSumma+" kr"; document.getElementById("moms").innerHTML=moms+" kr"; document.getElementById("totalt").innerHTML=totalt+" kr"; } }else{ document.getElementById(prisDiv).innerHTML=" (0)"; document.getElementById(prisDiv).style.display = "none"; for (i=0;i<=antalPrd;i++){ var x = parseInt(document.getElementById("prdPris"+i).value); var y = parseInt(document.getElementById("pris"+i+"_input").value); if(isNaN(x)){ x=0; } if(isNaN(y)){ y=0; } prdSumma += x*y; moms = prdSumma * 0.25; totalt = prdSumma + moms; document.getElementById("summa").innerHTML=prdSumma+" kr"; document.getElementById("moms").innerHTML=moms+" kr"; document.getElementById("totalt").innerHTML=totalt+" kr"; } } }