📜  js 将 html 转换为文本 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:52.597000             🧑  作者: Mango

代码示例1
// To remove all HTML tags use the ".replace(/<[^>]+>/g, '')" method.
let myHTML= "

Jimbo.

\n

That's what she said

"; let strippedHtml = myHTML.replace(/<[^>]+>/g, ''); console.log(stripedHtml); // Jimbo. That's what she said