js去掉前后空格

   function String.prototype.Trim() { return this.replace(/(^\s*)|(\s*$)/g, ""); }   
      function String.prototype.Ltrim() { return this.replace(/(^\s*)/g, ""); }
      function String.prototype.Rtrim() { return this.replace(/(\s*$)/g, ""); }  
原文地址:https://www.cnblogs.com/wuming/p/1439525.html