html去掉所有标签只留文本

it2026-02-04  0

// 方法 str.replace(/<[^>]+>/g,""); // 例子 let str = '<div><p>你好</p><img src="http:www.baidu.com"></div>' let _a = str.replace(/<[^>]+>/g,""); console.log(_a); // 你好
最新回复(0)