Answer the question
In order to leave comments, you need to log in
How to write it in native js?
this.$ = cheerio.load(html)
this.$('#myApp').removeAttr('data-server-rendered').removeAttr('id')
this.$(`body script[src="/myApp/app.js"]`).remove()
this.$(`head link[href="/myApp/app.js"]`).remove()
Answer the question
In order to leave comments, you need to log in
const html = parseHTML('<a href="#">Example</a>');
const text = html.querySelector('a').innerText;
console.log(text); //> Example
function parseHTML(html) {
var page = document.implementation.createHTMLDocument();
page.body.innerHTML = html;
return page.body;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question