且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用jQuery向价格添加尾随零

更新时间:2022-01-25 06:52:17

您可以使用javascript的toFixed方法(

You can use javascript's toFixed method (source), you don't need jQuery. Example:

var number = 258.2;    
var rounded = number.toFixed(2); // rounded = 258.20

电动工具箱"链接已屈服于linkrot并阻止了Wayback Machine,因此该源没有可用的URL.

Electric Toolbox link has succumbed to linkrot and blocks the Wayback Machine so there is no working URL for the source.