Javascript examples for jQuery:Number
Parsing decimals into a span
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.5.2.js"></script> <script type="text/javascript"> $(window).load(function(){/*from www .j a v a 2s . c o m*/ $('input').change(function () { var val = parseFloat($(this).val(), 10).toFixed(2); $('span').html(val); }); }); </script> </head> <body> <input value="123"> <span></span> </body> </html>