movieprodw
asked on
Hide h2 with same data-state
I am stuck, I have a list of divs and h2's I want it so if all the divs in div.clflexbox are :hidden then it hides the H2 with the matching data-state
jQuery("div[data-state]").each(function(){
var statedata = $(this).data('state');
if ( jQuery("div[data-state=" + statedata + "] .clad:visible").length === 0) {
jQuery("h2 > [data-state=" + statedata + "]").hide( );
} else {
jQuery("h2 > [data-state=" + statedata + "]").show( );
}
});
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
jQuery("h2[data-state=" + statedata + "]").hide( );
mean you've :
<h2 data-state="somestate">