multiply two decimals <p>Im trying to add a tax field. I have this working for whole numbers but i need to be able to enter ".5" I have no clue haw to solve this problem maybe its because of the isNAN but i thought this would be ok here.</p> <p><a href="http://jsfiddle.net/thetylercox/eeMva/3/" rel="nofollow">http://jsfiddle.net/thetylercox/eeMva/3/</a></p> <p>My current code</p> <pre><code>$(document).ready(function() { calculateSum(); $(".txt").keyup(function() { $(".txt").each(function() { calculateSum(); }); }); }); $("#tax").keyup(function() { $('#total1').val(parseInt($(this).val()) * parseInt($('#subtotal').val())); ); function calculateSum() { var sum = 0; $("#sum").val(sum.toFixed(2)); //iterate through each textboxes and add the values $(".txt").each(function() { //add only if the value is number if (!isNaN(this.value) &amp;&amp; this.value.length != 0) { sum += parseFloat(this.value); } }); $("#sum").html(sum.toFixed(2)); var subtotal = document.getElementById("subtotal").value == ""; var subtotal = document.getElementById("subtotal").value = sum; function getTax(tax) { var taxFloat = parseFloat(tax) if (isNaN(taxFloat)) { return 1; } else { return taxFloat; } } var total = getTax($('#tax').val()) * sum; var total1 = document.getElementById("total1").value = total; } ​ </code></pre> <p>Thanks </p>