Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js convert html to text

// To remove all HTML tags use the ".replace(/<[^>]+>/g, '')" method.
let myHTML= "<div><h1>Jimbo.</h1>
<p>That's what she said</p></div>";
let strippedHtml = myHTML.replace(/<[^>]+>/g, '');
console.log(stripedHtml); // Jimbo. That's what she said
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #js #convert #html #text
ADD COMMENT
Topic
Name
6+2 =