Streaming live at 10am (PST)

Hide empty section OR child containers

I need to dynamically hide containers in a section if there is no CMS content available, and if all containers have no content, then hide the section. I’m currently using this script to hide empty sections (thanks to someone on the forums!)

<script>
$('.w-dyn-empty').parents('.section--clear').each(function(){ $(this).hide()})
</script>

This script doesn’t have conditional logic for hiding the sections only if its child containers are empty. I’m not sure how to change it or where to go to learn more.

Looking for help. Thanks