javascript - remove decimal places Jquery/JS -


can point me in right direction please remove decimal places on different length of number sits within span i.e. prices of products on website.

£6.9800

the above should £6.98

we have website prices needed in 4 decimal places e.g £0.0260 , have our site setup display this. have other prices not needed e.g. above price , £0.99, £1.99, £10.99, £100.99, £1000.99

is there way can restrict prices 2 decimal places without rounding?

i can use js/jquery (because cms lets me).

i've tried trim , such cant seem cater different length numbers (i'm being dumb)

i thought use i'm not 100% sure: http://www.mredkj.com/javascript/numberformat.html

use "tofixed" method. in way:

var f = 1.2345; f.tofixed( 2 );  

edit: can see gumbo's answer in question: display 2 decimal places, no rounding

regards, kevin


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -