converting integer to float with precision 2 using Javascript or Jquery

Use .toFixed:

var num = 45;
num.toFixed(2); //"45.00"

var num = 10;
var result = num.toFixed(2);

http://www.mredkj.com/javascript/nfbasic2.html


This a very common problem I see someone has already answered, I want to add to it, if you want to further use the number after conversion for calculations Try this in console

a = 10.2222;
console.log(typeof a) // "number"
console.log(a)        // 10.2222 

b = parseFloat(a).toFixed(2);
console.log(typeof b) // "String"
console.log(b)        // "10.22"

c = parseFloat(b)
console.log(typeof c) // "number"
console.log(c)        // 10.22

Explanation is-

toFixed() method outputs a string variable
but if you want to further use the value of b as a 'number'
you will have to, 
c = parseFloat(b)
typeof c
// "number"