function trimStr(str){return str.replace(/(^\s*)|(\s*$)/g,"");} 或value.trim(); 转载于:https://www.cnblogs.com/hi-shepherd/p/6137861.html