I am trying to get different values from my input fields, divide them and show the result like this:
<input type="text" class="ad-title calculate form-control" name="budget" id="budget" value="" placeholder="Enter a daily budget in USD">
<input type="text" class="form-control calculate" id="ppc" name="ppc" value="" placeholder="">
My simple jQuery:
$(document).ready(function() {
$(".calculate").bind("keyup change", function(e) {
var budget = parseFloat($("#budget").val());
var ppc = parseFloat($("#ppc").val());
var value = ppc / budget;
$("#sum").text(value);
});
});
However, in my #sum
div, all I see is: NaN
What am I doing wrong?