On the face of it, this should be easy but I have stumbled on it for some time already.
I am trying to hide a <h2>
only tag when certain text appears. CMS generates the tag. HTML looks like this:
<div class="Block Moveable Panel" id="BrandContent">
<h2>All Brands</h2>
<div class="BlockContent">
BRANDS LISTED HERE...
</div>
</div>
If "All Brands" is included in the h2 tag, then I want the tag removed or hidden.
I have tried a few combinations of the below code without success:
if($('#BrandContent > div.h2:contains("All Brands")').length > 0) {
$('#BrandContent h2').css('visibility', 'hidden')
}
and
$('#BrandContent h2').remove(":contains('All Brands')");
Thank you in advance for any suggestions. M