SimonGates
SimonGates

Reputation: 6121

convert simple c# method to jquery

double myNumber;

myNumber.ToString("0.:#0").Replace(".", "");

Could someone tell me the equivalent jquery function?

Sorry not to good with jquery.

Thanks,

Upvotes: 0

Views: 633

Answers (1)

dontangg
dontangg

Reputation: 4809

jQuery is not necessary for this and actually doesn't have number formatting methods (unless you use a plugin).

I would do it like this just using native JavaScript:

var myNumber;

myNumber.toFixed(2).replace(".", ":");

The toFixed() method allows you to specify the number digits after the decimal place.

Upvotes: 5

Related Questions