如何去掉所有html标签的属性部分

2025-03-19 15:38:51
推荐回答(1个)
回答1:

去掉html标签: str.replace(/<]*>/g,"")
去掉标签里面的属性: str.replace(/<([a-zA-Z]+)\s*[^><]*>/g,"<$1>")
上面方法复制进去就行了。