further to that, you can do
var distance = parseInt($("#distance".val(), 10);
Using the radix (the second parameter - 10 in this case), forces the
specific conversion you'd like. When dealing with dates at least,
leaving out the radix can sometimes result in abnormal behavior that is
VERY hard to troubleshoot.
Oh, if the number is not an integer, use parseFloat() instead of
parseInt(). (er, sry if this is TOOO basic.. :) )
Shawn
Giovanni Battista Lenoci wrote:
runrunforest ha scritto:
Hi, I'm making a calculator for freight customer
It seems I'm on the right path. But there is two bugs i need help.
The TOTAL TO PAY value always seem to appear as NaN at first instead
of default 30000.
And the function of TOTAL TO PAY only work after checkbox is checkd, I
need it work regarding to changing of input value not just checkbox.
I didn't chek all of your code, but remember:
$('#distance').val();
returns a string, not an int.
Bye