ie8 不支持 trim方法

那就自己写一个trim() 
String.prototype.trim = function() {
                return this.replace(/(^s*)|(s*$)/g, ""); //正则匹配空格  
   }
原文地址:https://www.cnblogs.com/j190512/p/12574401.html