show-notice
hide-notice

Thursday, 15 August 2013

Convert string to float or double using jquery


Introduction:

Find code to convert String to float or double using jQuery. To convert, use JavaScript parseFloat() function parses a string and returns a floating point number.

Example:


var sVal = '234.54';
var iNum = parseFloat(sVal); //Output will be 234.54.

If you string contains spaces then only first number will be returned.
var sVal = '23.25 45.25 68';
var iNum = parseFloat(sVal); //Output will be 23.25

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com