去掉字符串中的html标签

motioliang2021-8-21jsjs

有些时候只需要获取到字符串中的文字内容,不需要 html 标签,用以下代码实现

//去掉字符串中标签
content = content
    .replace(/<.+?>/g, '')
    .replace(/&nbsp;/gi, '')
    .replace(/\s/gi, '')
最后更新时间 2021/12/16 14:55:02