by
97 7

Hide element(s) by class

Some examples for hiding the class.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/2493355/Hide-element(s)-by-class?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
//Ex //<div class="appBanner">appbanner</div> document.getElementsByClassName('appBanner')[0].style.visibility = 'hidden'; //change the style rules of all elements matching the class [].forEach.call(document.querySelectorAll('.appBanner'), function (el) { el.style.visibility = 'hidden'; }); //If for...of is available then use for (let el of document.querySelectorAll('.appBanner')) el.style.visibility = 'hidden'; //And the other one Array.filter( document.getElementsByClassName('appBanner'), function(elem){ elem.style.visibility = 'hidden'; }); //and the last one var appBanners = document.getElementsByClassName('appBanner'), i; for (i = 0; i < appBanners.length; i += 1) { appBanners[i].style.display = 'none'; }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus