I have this JS Code:
$("#submit").on('click',function() {
//work out number of days between the two dates
var days_between = $("#todate").val() - $("#fromdate").val()
//do the cost per month times 12 (months)
var year_cost = $("#cost_per_month").val() * 12
//do the yearly cost / 365
var daily_cost = year_cost / 365
var daily_cost = parseFloat( daily_cost.toFixed(2) )
//now do the daily cost times cost_per_month
var total_cost = daily_cost * days_between
$(".total_days").html(days_between);
$(".total_cost").html(total_cost);
})
I am getting an error saying NaN though.
i am entering the following:
#from_date = 2014-08-19
#to_date = 2014-08-31
#cost_per_month = 2.60