views:

63

answers:

1

I have a textbox where a user inputs a number, like: 105.14 When I use jQuery to read it:

alert(parseInt($("#Info").val()));

It displays "105".

Why can't I get the remaining .14????

I'm sure it's something obvious....

+10  A: 

This is because you are using parseInt(), which is rounding.

Try parseFloat() instead.

cballou
i've looked at this code about 200 times today, and tried using .toFixed(2) and doing a parseFloat afterwards, i did not see I was doing a parseInt.... Sometimes you just need another set of eyes, thanks..
hminaya
I hear you on that one.
cballou