티스토리 뷰

공부

[JavaScript] remove tags

승가비 2021. 11. 29. 16:02
728x90
'<html>asdf</html>'.replace(/<[^>]+>/g, '');

https://www.codegrepper.com/code-examples/javascript/how+to+replace+all+html+tags+in+javascript 

 

how to replace all html tags in javascript Code Example

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 //

www.codegrepper.com

 

728x90
댓글