js替换所有空格

str.replace(/\s+/g,"");

如果直接使用replace(" ","")则只能替换一个空格

猜你喜欢

转载自www.cnblogs.com/zhaogaojian/p/12890863.html
今日推荐