var MAX_PERIOD = $(‘#MAX_PERIOD‘).val(); // 借款的最大期限
MAX_PERIOD=Trim(MAX_PERIOD,"g"); //带 g 是去除全局空格
MAX_PERIOD=Trim(MAX_PERIOD,""); //不带 g 是去除两端空格
function Trim(str,is_global)
{
var result;
result = str.replace(/(^\s+)|(\s+$)/g,"");
if(is_global.toLowerCase()=="g")
{
result = result.replace(/\s/g,"");
}
return result;
}
原文地址:https://www.cnblogs.com/liyuspace/p/9262494.html
时间: 2024-11-01 16:26:36