Top Ad unit 728 × 90

Two digits number after decimal point using jquery

I would like to format my numbers to always display 2 decimal places, rounding where applicable.

Example: number      display
                ----------     -------------
                1                 1.00
                1.341          1.34
                1.345          1.35

I have been using this:

parseFloat(num).toFixed(2);

But it's displaying 1 as 1 rather than 1.00

Can anyone please help? Thanks!
Two digits number after decimal point using jquery Reviewed by Nancy on 03:18:00 Rating: 5

1 comment:

  1. Two digits floating numbers in round format in JQuery / Javascript you may try the following

    Math.round(num).toFixed(2);

    ReplyDelete

Thanks for sharing your valuable comments.

All Rights Reserved by ASENwebmedia © 2014 - 2015
Powered By Blogger, Developed by Asenwebmedia

Contact Form

Name

Email *

Message *

Powered by Blogger.