开发者

convert simple c# method to jquery

开发者 https://www.devze.com 2023-02-01 09:46 出处:网络
double myNumber; myNumber.ToString(\"0.:#0\").Replace(\".\", \"\"); Could someone tel开发者_高级运维l me the equivalent jquery function?
double myNumber;

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

Could someone tel开发者_高级运维l me the equivalent jquery function?

Sorry not to good with jquery.

Thanks,


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消