Reputation: 55
I have a little problem. With GET method I am getting data as an HTML String. And now, I want to display only data from:
CONTENTHow I can filter only this tag and class from the html string that is returned with GET method?
Thank you.
Upvotes: 2
Views: 3873
Reputation: 2376
What you can do is to create a DOM element and set the innerHTML
property to the HTML string.
let res = '<div class="wiki-holder prepend-top-default append-bottom-default">CONTENT</div>';//In your case this will contain the whole HTML string
let div = document.createElement('div');
div.innerHTML = res;
let selected = div.getElementsByClassName('wiki-holder prepend-top-default append-bottom-default');
document.write(selected[0].innerHTML);//The first element of this className
Upvotes: 2