function Trim(str)
 { 
  return str.replace(/(^\s*)|(\s*$)/g, ""); 
}

  

 

如果使用jQuery直接使用$.trim(str)方法即可,str表示要去掉前后所有空格的字符串

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-20
  • 2021-10-15
  • 2021-08-13
相关资源
相似解决方案