Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript hide all elements except one

const allElements = document.body.getElementsByTagName('*');
for(const elem of allElements){
	if(elem.className !== "") elem.remove(); // I used className here, any selector goes!
}
 
PREVIOUS NEXT
Tagged: #javascript #hide #elements
ADD COMMENT
Topic
Name
1+7 =