I have been looking around at different ways of hiding a parent div if the child div is empty of content, I have got it working in some fiddles, but nothing seems to work on my actual site.
I am editing Wordpress plugin CPT Bootstrap carousel, I have added a new custom field for displaying testimonials, but currently have only got one testimonial from a client so therefore want to hide the button when the div is emtpy.
Here is a link to the page: http://rookdesigns.co.uk/portfolio/
and here is my html and jQuery:
<div class="test btn btn-primary">Testimonials>>
<div class="carousel-quotes">
<?php echo $image[ 'reff']; ?>
</div>
</div>
jQuery(".carousel-quotes:empty").parent().hide();
I am also using this piece of jQuery to fadeToggle the child div on and off
jQuery(".test").click(function(){
jQuery('.carousel-quotes').fadeToggle();
Not sure if this could be effecting things.
Any help with this is very much appreciated,
Thanks in advance
All the best
Harry