javascript strip html tags from string
var htmlString= "<div>\n <h1>Hello World</h1>\n <p>This is the text that we should get.</p>\n <p>Our Code World © 2017</p>\n </div>";
var stripedHtml = htmlString.replace(/<[^>]+>/g, '');
var decodedStripedHtml = he.decode(stripedHtml);
// Hello World
// This is the text that we should get.
// Our Code World © 2017
console.log(stripedHtml);
// Hello World
// This is the text that we should get.
// Our Code World © 2017
console.log(decodedStripedHtml);
Also in HTML:
- include javascript jquery file in html
- iframe in html
- contact form html
- bootstrap email address validation
- how to gather true or false value from html checkbox in javascript
- dropdown menu html
- html space tag
- javascript get form data
- flask pandas dataframe to html table pdf
- how to break the line in html
- html div tag
- vuetify v-text-field bottom padding
- display div while load
- html textarea auto height to amount of text
- add an anchor tag onclick
- js variable html
- ubuntu vm workstation 12
- accept only image input file
- code html
- javascript prompt
- redirect html
- html5 prefix
- html icon x
- swift set html text