I want to remove all the elements in the page except for the elements that I want.
So I am thinking of this method:
document.body.innerHTML = texts.innerHTML;
I tried the code below but it only appends the 1st element of texts to body.innerHTML.
var texts = document.getElementsByClassName('HoXoMd D1wxyf G4EHhc');
for(let text of texts){
document.body.innerHTML = text.innerHTML;
}
I tried the code below but nothing happens:
var texts = document.getElementsByClassName('HoXoMd D1wxyf G4EHhc');
for(let text of texts){
document.body.innerHTML += text.innerHTML;
}
i am new to javascript thanks