function fix(num, N) { var base = Math.pow(10, N); return Math.round(num * base) / base; }
实例,取小数后边两位
var yhmoney2 = fix(1.22222, 2);
jQuery去掉字符串首尾空字符串
str=str.replace(/(^\s*)|(\s*$)/g, "")
-hao 2018-06-28 17:04 原文
function fix(num, N) { var base = Math.pow(10, N); return Math.round(num * base) / base; }
实例,取小数后边两位
var yhmoney2 = fix(1.22222, 2);
jQuery去掉字符串首尾空字符串
str=str.replace(/(^\s*)|(\s*$)/g, "")