text——含有HTML标签的字符串 var text1=text.replace(/<\/?.+?>/g,""); text=text1.replace(/ /g,""); 转载于:https://www.cnblogs.com/guoxiangyue/p/10785451.html