JSFiddle - React, Tailwind, and code Playground
JavaScript
var html = '<title>Ololo - text’s life</title><div class="page-wrap"><div class="ng-scope"><div class="modal custom article ng-scope in" id="new-article" aria-hidden="false" style="display: block;"><div class="modal-dialog first-modal-wrapper"><div class="modal-content"><div class="modal-body full long"> <div class="form-group">olololo<ul style="color: rgb(85, 85, 85);background-color: rgb(255, 255, 255);"><li>texttext</li><li>Filter the events lists by host.</li><li>Create graphs for separate hosts and for the groups of hosts.</li> </ul><p style="color: rgb(85, 85, 85);background-color: rgb(255, 255, 255);">bbcvbcvbcvbcvbcvbcvbcvb</p></div><div></div></div></div></div><title>cvbcbcvbcvbcvbccb</title><div class="page-wrap"></div></div>';
var div = document.createElement('div');
div.innerHTML = html;
function removeAllAttrs(element) {
for (var i = element.attributes.length; i-- > 0;)
element.removeAttributeNode(element.attributes[i]);
}
function removeAttributes(el) {
var children = el.children;
for (var i = 0; i < children.length; i++) {
var child = children[i];
removeAllAttrs(child);
if (child.children.length) {
removeAttributes(child);
}
}
}
removeAttributes(div);
console.log(div.innerHTML);