Source: https://ourcodeworld.com/articles/read/376/how-to-strip-html-from-a-string-extract-only-text-content-in-javascript
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);
Đăng ký:
Đăng Nhận xét (Atom)
api feed with published=false?
Câu trả lời ngắn gọn là: CÓ . Trên thực tế, đây chính là cách chuẩn nhất để tạo các bài viết chưa hiển thị công khai (bao gồm Bản nháp, B...
-
Basic usage | Documentation | Poetry - Python dependency management and packaging made easy (python-poetry.org) Activating the virtual env...
-
Source: https://indepth.dev/stop-using-shared-material-module/ This article describes an experiment that shows why using the SharedMate...
-
https://azdigi.com/blog/en/webserver-panel-en/directadmin-en/fix-the-error-cxxabi-1-3-9-not-found-on-centos-7-running-directadmin/ In this ...
Không có nhận xét nào:
Đăng nhận xét