You are here

Get rid of decimal points in Jquery

You can use the math round function in jquery to remove the decimal points in jquery.

For example:

Math.round(65.98)
// will return 66
Math.round(65.28)
// will return 65

To get one decimal point number in jquery

Again we can use the math round jquery function to get one decimal point number. For example:

var number = 24.4543 1.)
// round to two decimal points
var outcome = Math.round(number*100)/100
// returns 24.45
2.) // round to one decimal points
var outcome = Math.round(number*10)/10
// returns 24.4

Tags: 

Website fix request form

If you have problems with the website based on Drupal or WordPress, please feel free to contact us: