Skip to content Skip to sidebar Skip to footer

Parsefloat Does Not Work On Mobile Devices

I am writing a very basic html calculator. The end result and user inputs are shown in 'textDisplay_' area below:

Solution 1:

I'm pretty sure that your problem is not what you think it is. Please visit this page on your desktop and mobile browser. For me, they produce the same results.

https://jsfiddle.net/xpkhqdLa/1/

With str being a string holding a floating point number, all of the below produce the same, proper floating-point value:

var values = [ str*1, 1*str, 1.0*str, parseFloat(str) ];

Solution 2:

You can try:

var t = 1.0 * getCurrentText();

to get a float.

Post a Comment for "Parsefloat Does Not Work On Mobile Devices"