Archived topic
Hide/Show an element class based on another element class
3 replies · Started by Marketers Company SRL on September 6, 2018
Viewing posts 1–4 of 4
Hi Tom,
thanks for your great work.
I try to hide a class (and an id) based on another class.
I try this solution https://stackoverflow.com/questions/4318391/jquery-hide-class-if-other-class-is-visible-or-shown and I embedded it on wp footer hook, but it doesn't work maybe because gp doesn't load any jQuery.
How can I do the same with vanilla?
Thanks in advance.
You could try this:
var someElement = document.querySelector( '.some-element' );
if ( someElement ) {
document.querySelector( '.another-element' ).style.display = 'none';
}
Great Tom,
works perfectly!
Awesome :)
This archived topic is closed to new replies.